-
-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathapi_point.test.js
57 lines (55 loc) · 1.52 KB
/
api_point.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
const gdal = require('../lib/gdal.js')
const assert = require('chai').assert
describe('gdal.Point', () => {
afterEach(gc)
let point2d
let point3d
before(() => {
point2d = new gdal.Point(1, 2)
point3d = new gdal.Point(1, 2, 3)
})
it('should inherit from Geometry', () => {
assert.instanceOf(point2d, gdal.Point)
assert.instanceOf(point2d, gdal.Geometry)
assert.instanceOf(point3d, gdal.Point)
assert.instanceOf(point3d, gdal.Geometry)
})
it('should be valid', () => {
assert.equal(point2d.isValid(), true)
assert.equal(point3d.isValid(), true)
})
it('should be simple', () => {
assert.equal(point2d.isSimple(), true)
assert.equal(point3d.isSimple(), true)
})
describe('instance', () => {
describe('"x","y","z" properties', () => {
it('should be gettable', () => {
assert.equal(point2d.x, 1)
assert.equal(point2d.y, 2)
assert.equal(point2d.z, 0)
assert.equal(point3d.x, 1)
assert.equal(point3d.y, 2)
assert.equal(point3d.z, 3)
})
it('should be settable', () => {
const pt = new gdal.Point(1, 2, 3)
pt.x = 4
pt.y = 5
pt.z = 6
assert.equal(pt.x, 4)
assert.equal(pt.y, 5)
assert.equal(pt.z, 6)
})
})
describe('swapXY()', () => {
it('should flip x,y coordinates', () => {
const pt = new gdal.Point(1, 2, 3)
pt.swapXY()
assert.equal(pt.x, 2)
assert.equal(pt.y, 1)
assert.equal(pt.z, 3)
})
})
})
})