Sha256: f6515fc8ecc47809b9ebea7cbe64825f4878079863672665f8ff3ec40cfb0bed

Contents?: true

Size: 1.36 KB

Versions: 4

Compression:

Stored size: 1.36 KB

Contents

var vows = require("vows"),
    _ = require("../../"),
    load = require("../load"),
    assert = require("../assert");

var suite = vows.describe("d3.geo.clipView");

suite.addBatch({
  "clipView": {
    topic: load("../test/geo/clip-view-mock").expression("d3.geo.clipView"),
    "100тип100": {
      topic: function(clipView) {
        return clipView(0, 0, 100, 100);
      },
      "invisible segments are dropped": function(clip) {
        _.geo.stream({type: "LineString", coordinates: [
          [-100, 50],
          [-50, 50],
          [50, 50]
        ]}, clip(testContext));
        assert.deepEqual(testContext.buffer(), [
          {type: "lineStart"},
          {type: "point", x: 0, y: 50},
          {type: "point", x: 50, y: 50},
          {type: "lineEnd"}
        ]);
      }
    }
  }
});

suite.export(module);

var testBuffer = [];

var testContext = {
  point: function(x, y) { testBuffer.push({type: "point", x: Math.round(x), y: Math.round(y)}); },
  lineStart: function() { testBuffer.push({type: "lineStart"}); },
  lineEnd: function() { testBuffer.push({type: "lineEnd"}); },
  polygonStart: function() { testBuffer.push({type: "polygonStart"}); },
  polygonEnd: function() { testBuffer.push({type: "polygonEnd"}); },
  sphere: function() { testBuffer.push({type: "sphere"}); },
  buffer: function() { var result = testBuffer; testBuffer = []; return result; }
};

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
stripchart-0.0.3 lib/stripchart/public/components/d3/test/geo/clip-view-test.js
stripmem-0.0.3 lib/stripmem/public/components/d3/test/geo/clip-view-test.js
stripmem-0.0.2 lib/stripmem/public/components/d3/test/geo/clip-view-test.js
stripmem-0.0.1 lib/stripmem/public/components/d3/test/geo/clip-view-test.js