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
import { ComponentDatatype } from "../../Source/Cesium.js";
import { ShowGeometryInstanceAttribute } from "../../Source/Cesium.js";
 
describe("Core/ShowGeometryInstanceAttribute", function () {
  it("constructor", function () {
    var attribute = new ShowGeometryInstanceAttribute(false);
    expect(attribute.componentDatatype).toEqual(
      ComponentDatatype.UNSIGNED_BYTE
    );
    expect(attribute.componentsPerAttribute).toEqual(1);
    expect(attribute.normalize).toEqual(false);
 
    expect(attribute.value).toEqual(new Uint8Array([false]));
  });
 
  it("toValue", function () {
    var expectedResult = new Uint8Array([true]);
    expect(ShowGeometryInstanceAttribute.toValue(true)).toEqual(expectedResult);
  });
 
  it("toValue works with a result parameter", function () {
    var expectedResult = new Uint8Array([true]);
    var result = new Uint8Array(1);
    var returnedResult = ShowGeometryInstanceAttribute.toValue(true, result);
    expect(returnedResult).toEqual(expectedResult);
    expect(returnedResult).toBe(result);
  });
 
  it("toValue throws without a color", function () {
    expect(function () {
      ShowGeometryInstanceAttribute.toValue();
    }).toThrowDeveloperError();
  });
});