yzt
2023-05-26 2f70f6727314edd84d8ec2bfe3ce832803f1ea77
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
import { PixelDatatype } from "../../Source/Cesium.js";
import { PixelFormat } from "../../Source/Cesium.js";
 
describe("Core/PixelFormat", function () {
  it("flipY works", function () {
    var width = 1;
    var height = 2;
    var values = [255, 0, 0, 0, 255, 0];
    var expectedValues = [0, 255, 0, 255, 0, 0];
    var dataBuffer = new Uint8Array(values);
    var expectedDataBuffer = new Uint8Array(expectedValues);
 
    var flipped = PixelFormat.flipY(
      dataBuffer,
      PixelFormat.RGB,
      PixelDatatype.UNSIGNED_BYTE,
      width,
      height
    );
    expect(flipped).toEqual(expectedDataBuffer);
  });
 
  it("flipY returns early if height is 1", function () {
    var width = 1;
    var height = 1;
    var values = [255, 255, 255];
    var dataBuffer = new Uint8Array(values);
 
    var flipped = PixelFormat.flipY(
      dataBuffer,
      PixelFormat.RGB,
      PixelDatatype.UNSIGNED_BYTE,
      width,
      height
    );
    expect(flipped).toBe(dataBuffer);
  });
});