-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from CesiumGS/update-alignment
Add function to update alignment
- Loading branch information
Showing
14 changed files
with
149 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
Individual tile content files (one of each type) for testing the `updateAlignment` | ||
command. These have been taken from the state at | ||
https://github.com/CesiumGS/cesium/blob/83306253e36bbc3fb53801fdae8dee62f1a47be5 | ||
which was before the alignment of the spec data was fixed via | ||
https://github.com/CesiumGS/cesium/commit/4b3b4186b4afa2307d7d1666569826d864b984ca | ||
|
||
The `testComposite.cmpt` was created specifically for this test, | ||
from `batchedColors.b3dm` and `pointCloudRGB.pnts`. | ||
|
||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import fs from "fs"; | ||
|
||
import { Paths } from "../../../src/base"; | ||
|
||
import { ContentOps } from "../../../src/tools"; | ||
|
||
import { SpecHelpers } from "../../SpecHelpers"; | ||
|
||
const SPECS_DATA_BASE_DIRECTORY = SpecHelpers.getSpecsDataBaseDirectory(); | ||
|
||
const sourceDir = SPECS_DATA_BASE_DIRECTORY + "/updateAlignment"; | ||
const targetDir = SPECS_DATA_BASE_DIRECTORY + "/updateAlignment/output"; | ||
const goldenDir = SPECS_DATA_BASE_DIRECTORY + "/updateAlignment/golden"; | ||
|
||
function updateAlignmentForSpec(fileName: string) { | ||
const sourceFileName = sourceDir + "/" + fileName; | ||
const targetFileName = targetDir + "/" + fileName; | ||
const goldenFileName = goldenDir + "/" + fileName; | ||
|
||
const sourceData = fs.readFileSync(sourceFileName); | ||
|
||
const targetData = ContentOps.updateAlignment(sourceData); | ||
Paths.ensureDirectoryExists(targetDir); | ||
fs.writeFileSync(targetFileName, targetData); | ||
|
||
const goldenData = fs.readFileSync(goldenFileName); | ||
const passed = targetData.equals(goldenData); | ||
return passed; | ||
} | ||
|
||
describe("ContentOps", function () { | ||
afterEach(function () { | ||
SpecHelpers.forceDeleteDirectory(targetDir); | ||
}); | ||
|
||
it("updateAlignment updates the alignment of a B3DM file", async function () { | ||
const fileName = "batchedColors.b3dm"; | ||
const passed = updateAlignmentForSpec(fileName); | ||
expect(passed).toBe(true); | ||
}); | ||
|
||
it("updateAlignment updates the alignment of an I3DM file", async function () { | ||
const fileName = "instancedScale.i3dm"; | ||
const passed = updateAlignmentForSpec(fileName); | ||
expect(passed).toBe(true); | ||
}); | ||
|
||
it("updateAlignment updates the alignment of a PNTS file", async function () { | ||
const fileName = "pointCloudRGB.pnts"; | ||
const passed = updateAlignmentForSpec(fileName); | ||
expect(passed).toBe(true); | ||
}); | ||
|
||
it("updateAlignment updates the alignment of a CMPT file", async function () { | ||
const fileName = "testComposite.cmpt"; | ||
const passed = updateAlignmentForSpec(fileName); | ||
expect(passed).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters