mirror of
https://github.com/openglobus/openglobus.git
synced 2025-12-08 19:25:27 +00:00
857 fixed tests
This commit is contained in:
parent
e700c660a4
commit
2b6c588a38
@ -23,7 +23,16 @@ export default [
|
||||
|
||||
languageOptions: {
|
||||
globals: {
|
||||
window: true
|
||||
window: true,
|
||||
vi: true,
|
||||
test: true,
|
||||
expect: true,
|
||||
describe: true,
|
||||
it: true,
|
||||
beforeEach: true,
|
||||
afterEach: true,
|
||||
beforeAll: true,
|
||||
afterAll: true
|
||||
},
|
||||
|
||||
parser: tsParser,
|
||||
|
||||
@ -123,11 +123,15 @@ export class KML extends Vector {
|
||||
|
||||
} else {
|
||||
return new Entity({
|
||||
name,
|
||||
polyline: {
|
||||
pathLonLat: [lonLats],
|
||||
thickness: lineWidth,
|
||||
color: lineColor,
|
||||
isClosed: false
|
||||
},
|
||||
properties: {
|
||||
name: name
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,15 +1,60 @@
|
||||
import { Extent } from "../src/Extent";
|
||||
import { LonLat } from "../src/LonLat";
|
||||
import { Planet } from "../src/scene/Planet";
|
||||
import { SegmentLonLat } from "../src/segment/SegmentLonLat";
|
||||
import { QuadTreeStrategy } from "../src/quadTree/QuadTreeStrategy";
|
||||
import { Node } from "../src/quadTree/Node";
|
||||
|
||||
const mockPlanet = () => {
|
||||
const planet = new Planet();
|
||||
planet.renderer = {};
|
||||
planet.terrain = { gridSizeByZoom: {} };
|
||||
planet.renderer = {
|
||||
handler: {
|
||||
gl: {
|
||||
createBuffer: vi.fn(),
|
||||
createTexture: vi.fn(),
|
||||
bindBuffer: vi.fn(),
|
||||
bufferData: vi.fn(),
|
||||
deleteBuffer: vi.fn(),
|
||||
deleteTexture: vi.fn()
|
||||
}
|
||||
}
|
||||
};
|
||||
planet.terrain = {
|
||||
gridSizeByZoom: {
|
||||
0: 256,
|
||||
1: 512,
|
||||
2: 1024
|
||||
}
|
||||
};
|
||||
planet.solidTextureOne = null;
|
||||
planet.solidTextureTwo = null;
|
||||
planet._createdNodesCount = 0;
|
||||
return planet;
|
||||
};
|
||||
|
||||
const mockQuadTreeStrategy = (planet) => {
|
||||
const strategy = new QuadTreeStrategy({ planet });
|
||||
return strategy;
|
||||
};
|
||||
|
||||
const mockNode = (quadTreeStrategy) => {
|
||||
const node = new Node(
|
||||
SegmentLonLat,
|
||||
quadTreeStrategy,
|
||||
0, // partId
|
||||
null, // parent
|
||||
0, // tileZoom
|
||||
new Extent(new LonLat(-180, -90), new LonLat(180, 90))
|
||||
);
|
||||
return node;
|
||||
};
|
||||
|
||||
test("Testing SegmentLonLat", () => {
|
||||
const segmentLonLat = new SegmentLonLat({}, mockPlanet(), {}, new Extent());
|
||||
const planet = mockPlanet();
|
||||
const quadTreeStrategy = mockQuadTreeStrategy(planet);
|
||||
const node = mockNode(quadTreeStrategy);
|
||||
const extent = new Extent(new LonLat(-180, -90), new LonLat(180, 90));
|
||||
|
||||
const segmentLonLat = new SegmentLonLat(node, quadTreeStrategy, 0, extent);
|
||||
expect(segmentLonLat).toBeTruthy();
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user