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" />
|
|
|
|
/// <reference path="../src/geometry/Bounds.ts" />
|
2024-04-09 11:21:33 -05:00
|
|
|
/// <reference path="../src/core/geometry.ts" />
|
2021-02-15 00:42:37 -06:00
|
|
|
|
|
|
|
var assert = require('assert').strict;
|
|
|
|
|
2021-09-29 10:50:44 -05:00
|
|
|
describe('Bounds parse() tests', function () {
|
2021-02-15 00:42:37 -06:00
|
|
|
|
2021-09-29 10:50:44 -05:00
|
|
|
describe('Bounds.parse() call with an empty string argument', function () {
|
2021-02-15 00:42:37 -06:00
|
|
|
it('should return undefined', function () {
|
2021-09-29 10:50:44 -05:00
|
|
|
assert.equal(cool.Bounds.parse(''), undefined);
|
2021-02-15 00:42:37 -06:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-09-29 10:50:44 -05:00
|
|
|
describe('Bounds.parse() call with an string argument with 3 numbers', function () {
|
2021-02-15 00:42:37 -06:00
|
|
|
it('should return undefined', function () {
|
2021-09-29 10:50:44 -05:00
|
|
|
assert.equal(cool.Bounds.parse('10 20 30'), undefined);
|
2021-02-15 00:42:37 -06:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-09-29 10:50:44 -05:00
|
|
|
describe('Bounds.parse() call with an string argument with 4 numbers', function () {
|
|
|
|
var bounds = cool.Bounds.parse('10 20 30 40');
|
|
|
|
it('should return a valid Bounds', function () {
|
|
|
|
assert.ok(bounds instanceof cool.Bounds);
|
2021-02-15 00:42:37 -06:00
|
|
|
assert.ok(bounds.isValid());
|
|
|
|
});
|
|
|
|
|
2021-09-29 10:50:44 -05:00
|
|
|
it('and the Bounds should be correct in position and size', function () {
|
|
|
|
assert.ok(bounds.equals(new cool.Bounds(new cool.Point(10, 20), new cool.Point(40, 60))));
|
2021-02-15 00:42:37 -06:00
|
|
|
});
|
|
|
|
});
|
2021-02-24 06:22:54 -06:00
|
|
|
|
2021-09-29 10:50:44 -05:00
|
|
|
describe('Bounds constructor call', function () {
|
|
|
|
it('correctness check with PointConstructable[] argument', function () {
|
|
|
|
var bounds = new cool.Bounds(
|
|
|
|
[
|
|
|
|
[10, 20],
|
|
|
|
{ x: 5, y: 50 },
|
|
|
|
[1, 2],
|
|
|
|
{ x: -1, y: 7 },
|
|
|
|
]);
|
|
|
|
var expected = new cool.Bounds(new cool.Point(-1, 2), new cool.Point(10, 50));
|
|
|
|
assert.deepEqual(expected, bounds);
|
2021-02-24 06:22:54 -06:00
|
|
|
});
|
|
|
|
});
|
2021-09-29 10:50:44 -05:00
|
|
|
});
|