15832144755
2022-01-06 7b4c8991dca9cf2a809a95e239d144697d3afb56
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import { Ellipsoid } from "../../../Source/Cesium.js";
import { Cesium3DTileset } from "../../../Source/Cesium.js";
import { Globe } from "../../../Source/Cesium.js";
import createScene from "../../createScene.js";
import { Cesium3DTilesInspector } from "../../../Source/Cesium.js";
 
describe(
  "Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector",
  function () {
    // Parent tile with content and four child tiles with content
    var tilesetUrl = "./Data/Cesium3DTiles/Tilesets/Tileset/tileset.json";
 
    var scene;
    beforeAll(function () {
      scene = createScene();
      var ellipsoid = Ellipsoid.UNIT_SPHERE;
      scene.globe = new Globe(ellipsoid);
    });
 
    afterAll(function () {
      scene.destroyForSpecs();
    });
 
    it("can create and destroy", function () {
      var container = document.createElement("div");
      container.id = "testContainer";
      document.body.appendChild(container);
 
      var widget = new Cesium3DTilesInspector("testContainer", scene);
      expect(widget.container).toBe(container);
      expect(widget.viewModel._scene).toBe(scene);
      expect(widget.isDestroyed()).toEqual(false);
      widget.destroy();
      expect(widget.isDestroyed()).toEqual(true);
 
      document.body.removeChild(container);
    });
 
    it("constructor throws with no element", function () {
      expect(function () {
        return new Cesium3DTilesInspector();
      }).toThrowDeveloperError();
    });
 
    it("constructor throws with string element that does not exist", function () {
      expect(function () {
        return new Cesium3DTilesInspector("does not exist", scene);
      }).toThrowDeveloperError();
    });
 
    it("constructor throws with no scene", function () {
      expect(function () {
        return new Cesium3DTilesInspector(document.body);
      }).toThrowDeveloperError();
    });
 
    describe("logging", function () {
      var widget;
      var container;
 
      beforeAll(function () {
        container = document.createElement("div");
        container.id = "testContainer";
        document.body.appendChild(container);
        widget = new Cesium3DTilesInspector("testContainer", scene);
 
        var viewModel = widget.viewModel;
        viewModel.tileset = new Cesium3DTileset({
          url: tilesetUrl,
        });
        return viewModel.tileset.readyPromise;
      });
 
      afterAll(function () {
        widget.destroy();
        document.body.removeChild(container);
      });
    });
  },
  "WebGL"
);