2021-10-12 01:53:06 -05:00
|
|
|
/// <reference path="./refs/globals.ts"/>
|
2021-09-29 10:50:44 -05:00
|
|
|
/// <reference path="../src/geometry/Point.ts" />
|
2022-04-11 01:36:20 -05:00
|
|
|
/// <reference path="../src/geometry/Bounds.ts" />
|
2021-02-11 06:27:33 -06:00
|
|
|
/// <reference path="../src/layer/vector/CPointSet.ts" />
|
|
|
|
|
|
|
|
var assert = require('assert');
|
|
|
|
|
|
|
|
describe('CPointSet empty() tests', function () {
|
|
|
|
|
|
|
|
describe('new CPointSet()', function () {
|
|
|
|
it('should be empty', function () {
|
|
|
|
assert.ok((new CPointSet()).empty());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-09-29 10:50:44 -05:00
|
|
|
describe('CPointSet constructed from Points', function () {
|
2021-02-11 06:27:33 -06:00
|
|
|
it('should be not be empty', function () {
|
2021-09-29 10:50:44 -05:00
|
|
|
var pointArray: Array<cool.Point> = [new cool.Point(10, 40), new cool.Point(50, 100)];
|
2021-02-11 06:27:33 -06:00
|
|
|
assert.ok(!CPointSet.fromPointArray(pointArray).empty());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('CPointSet constructed from array of CPointSets', function () {
|
|
|
|
it('should be not be empty', function () {
|
2021-09-29 10:50:44 -05:00
|
|
|
var pointArray: Array<cool.Point> = [new cool.Point(10, 40), new cool.Point(50, 100)];
|
2021-02-11 06:27:33 -06:00
|
|
|
var pSet1 = CPointSet.fromPointArray(pointArray);
|
2021-09-29 10:50:44 -05:00
|
|
|
pointArray = [new cool.Point(100, 400), new cool.Point(500, 1000)];
|
2021-02-11 06:27:33 -06:00
|
|
|
var pSet2 = CPointSet.fromPointArray(pointArray);
|
|
|
|
var pSetArray = [pSet1, pSet2];
|
|
|
|
assert.ok(!CPointSet.fromSetArray(pSetArray).empty());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-09-29 10:50:44 -05:00
|
|
|
describe('After setting an empty Point array to a non-empty CPointSet', function () {
|
2021-02-11 06:27:33 -06:00
|
|
|
it('the CPointSet should be empty', function () {
|
2021-09-29 10:50:44 -05:00
|
|
|
var pointArray: Array<cool.Point> = [new cool.Point(10, 40), new cool.Point(50, 100)];
|
2021-02-11 06:27:33 -06:00
|
|
|
var pSet = CPointSet.fromPointArray(pointArray);
|
|
|
|
pSet.setPointArray([]);
|
|
|
|
assert.ok(pSet.empty());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|