yzt
2023-05-05 4c558c77a6a9d23f057f094c4dc3e315eabef497
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
58
59
60
61
62
63
import { Cartesian3 } from "../../Source/Cesium.js";
import { JulianDate } from "../../Source/Cesium.js";
import { CallbackProperty } from "../../Source/Cesium.js";
import { ConstantProperty } from "../../Source/Cesium.js";
import { TerrainOffsetProperty } from "../../Source/Cesium.js";
import createGlobe from "../createGlobe.js";
import createScene from "../createScene.js";
 
describe("DataSources/TerrainOffsetProperty", function () {
  var scene;
  var time = JulianDate.now();
  beforeAll(function () {
    scene = createScene();
    scene.globe = createGlobe();
  });
 
  afterAll(function () {
    scene.destroyForSpecs();
  });
 
  it("can construct and destroy", function () {
    var position = new CallbackProperty(jasmine.createSpy(), false);
    var height = new ConstantProperty(30);
    var extrudedHeight = new ConstantProperty(0);
    var property = new TerrainOffsetProperty(
      scene,
      position,
      height,
      extrudedHeight
    );
    expect(property.isConstant).toBe(false);
    expect(property.getValue(time)).toEqual(Cartesian3.ZERO);
    property.destroy();
    expect(property.isDestroyed()).toBe(true);
  });
 
  it("throws without scene", function () {
    var position = new CallbackProperty(jasmine.createSpy(), false);
    var height = new ConstantProperty(30);
    var extrudedHeight = new ConstantProperty(0);
    expect(function () {
      return new TerrainOffsetProperty(
        undefined,
        position,
        height,
        extrudedHeight
      );
    }).toThrowDeveloperError();
  });
 
  it("throws without position", function () {
    var height = new ConstantProperty(30);
    var extrudedHeight = new ConstantProperty(0);
    expect(function () {
      return new TerrainOffsetProperty(
        scene,
        undefined,
        height,
        extrudedHeight
      );
    }).toThrowDeveloperError();
  });
});