-
Notifications
You must be signed in to change notification settings - Fork 156
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 #305 from CesiumGS/fix-external-tilesets-extension…
…s-validation Fix external tilesets extensions validation
- Loading branch information
Showing
19 changed files
with
472 additions
and
3 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { Validators } from "../src/validation/Validators"; | ||
|
||
// Note: These test cases use a dummy extension called | ||
// VENDOR_example_extension | ||
// So they will always create at least a WARNING about | ||
// this not being supported | ||
|
||
describe("External tileset extensions validation", function () { | ||
it("detects no errors in declaredInBothContainedInExternal", async function () { | ||
const result = await Validators.validateTilesetFile( | ||
"specs/data/tilesets/externalTilesetExtensions/declaredInBothContainedInExternal/tileset.json" | ||
); | ||
expect(result.length).toEqual(1); | ||
expect(result.get(0).type).toEqual("EXTERNAL_TILESET_VALIDATION_WARNING"); | ||
expect(result.get(0).causes[0].type).toEqual("EXTENSION_NOT_SUPPORTED"); | ||
}); | ||
|
||
it("detects no errors (but one warning) in declaredInBothContainedInTileset", async function () { | ||
const result = await Validators.validateTilesetFile( | ||
"specs/data/tilesets/externalTilesetExtensions/declaredInBothContainedInTileset/tileset.json" | ||
); | ||
expect(result.length).toEqual(2); | ||
expect(result.get(0).type).toEqual("EXTENSION_NOT_SUPPORTED"); | ||
expect(result.get(1).type).toEqual("EXTERNAL_TILESET_VALIDATION_WARNING"); | ||
expect(result.get(1).causes[0].type).toEqual( | ||
"EXTENSION_USED_BUT_NOT_FOUND" | ||
); | ||
}); | ||
|
||
it("detects an error in declaredInExternalContainedInExternal", async function () { | ||
const result = await Validators.validateTilesetFile( | ||
"specs/data/tilesets/externalTilesetExtensions/declaredInExternalContainedInExternal/tileset.json" | ||
); | ||
expect(result.length).toEqual(2); | ||
expect(result.get(0).type).toEqual("EXTERNAL_TILESET_VALIDATION_WARNING"); | ||
expect(result.get(0).causes[0].type).toEqual("EXTENSION_NOT_SUPPORTED"); | ||
expect(result.get(1).type).toEqual("EXTENSION_FOUND_BUT_NOT_USED"); | ||
}); | ||
|
||
it("detects an error and a warning in declaredInExternalContainedInTileset", async function () { | ||
const result = await Validators.validateTilesetFile( | ||
"specs/data/tilesets/externalTilesetExtensions/declaredInExternalContainedInTileset/tileset.json" | ||
); | ||
expect(result.length).toEqual(3); | ||
expect(result.get(0).type).toEqual("EXTENSION_NOT_SUPPORTED"); | ||
expect(result.get(1).type).toEqual("EXTERNAL_TILESET_VALIDATION_WARNING"); | ||
expect(result.get(1).causes[0].type).toEqual( | ||
"EXTENSION_USED_BUT_NOT_FOUND" | ||
); | ||
expect(result.get(2).type).toEqual("EXTENSION_FOUND_BUT_NOT_USED"); | ||
}); | ||
|
||
it("detects two errors in declaredInNoneContainedInExternal", async function () { | ||
const result = await Validators.validateTilesetFile( | ||
"specs/data/tilesets/externalTilesetExtensions/declaredInNoneContainedInExternal/tileset.json" | ||
); | ||
expect(result.length).toEqual(2); | ||
expect(result.get(0).type).toEqual("EXTERNAL_TILESET_VALIDATION_ERROR"); | ||
expect(result.get(1).type).toEqual("EXTENSION_FOUND_BUT_NOT_USED"); | ||
}); | ||
|
||
it("detects one error in declaredInTilesetContainedInExternal", async function () { | ||
const result = await Validators.validateTilesetFile( | ||
"specs/data/tilesets/externalTilesetExtensions/declaredInTilesetContainedInExternal/tileset.json" | ||
); | ||
expect(result.length).toEqual(1); | ||
expect(result.get(0).type).toEqual("EXTERNAL_TILESET_VALIDATION_ERROR"); | ||
expect(result.get(0).causes[1].type).toEqual( | ||
"EXTENSION_FOUND_BUT_NOT_USED" | ||
); | ||
}); | ||
|
||
it("detects no errors in declaredInTilesetContainedInTileset", async function () { | ||
const result = await Validators.validateTilesetFile( | ||
"specs/data/tilesets/externalTilesetExtensions/declaredInTilesetContainedInTileset/tileset.json" | ||
); | ||
expect(result.length).toEqual(1); | ||
expect(result.get(0).type).toEqual("EXTENSION_NOT_SUPPORTED"); | ||
}); | ||
}); |
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,25 @@ | ||
|
||
Test data for the validation of extensions in the context of external tilesets. | ||
|
||
(This is a special aspect of https://github.com/CesiumGS/3d-tiles-validator/issues/231 ). | ||
|
||
Each of these data sets consists of a `tileset.json` that refers to an `external.json`. | ||
|
||
They use a "dummy" extension called `VENDOR_example_extension` to check the validation | ||
of the `extensionsUsed` propery of a tileset. (This means that the validation will | ||
always at least create one warning, because the extension is not supported). | ||
|
||
In the following, the term.. | ||
|
||
- 'declared' means that a tileset declares the extension in its `extesionsUsed` | ||
- 'contained' means that the tileset actually contains such an extension object in its `extensions` | ||
|
||
These cases are considered: | ||
|
||
- `declaredInBothContainedInExternal`: This is valid. The external tileset contains it and declares it. The main tileset also declares it (because it refers to one that contains it). | ||
- `declaredInBothContainedInTileset`: This valid, but causes a warning. The external tileset does not have to declare it if it does not contain it. | ||
- `declaredInExternalContainedInExternal`: This is invalid. The main tileset also has to declare it when it refers to one that contains it. | ||
- `declaredInExternalContainedInTileset`: This is invalid. The main tileset has to declare it if it contains it. | ||
- `declaredInNoneContainedInExternal`: This is invalid. Both tilesets have to declare it when the external one contains it. | ||
- `declaredInTilesetContainedInExternal`: This is invalid. The external one also has to declare it when it contains it | ||
- `declaredInTilesetContainedInTileset`: This is valid. Only the main tileset has to declare it if only the main tileset contains it. |
23 changes: 23 additions & 0 deletions
23
...s/data/tilesets/externalTilesetExtensions/declaredInBothContainedInExternal/external.json
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,23 @@ | ||
{ | ||
"asset" : { | ||
"version" : "1.1" | ||
}, | ||
"geometricError" : 4.0, | ||
"root" : { | ||
"refine": "REPLACE", | ||
"boundingVolume" : { | ||
"box" : [ 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5 ] | ||
}, | ||
"geometricError" : 2.0 | ||
}, | ||
"extensionsUsed": [ | ||
"VENDOR_example_extension" | ||
], | ||
"extensions": { | ||
"VENDOR_example_extension": { | ||
"exampleExtension": { | ||
"description": "A dummy example extension" | ||
} | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
specs/data/tilesets/externalTilesetExtensions/declaredInBothContainedInExternal/tileset.json
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,27 @@ | ||
{ | ||
"asset" : { | ||
"version" : "1.1" | ||
}, | ||
"geometricError" : 4.0, | ||
"root" : { | ||
"refine": "REPLACE", | ||
"boundingVolume" : { | ||
"box" : [ 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5 ] | ||
}, | ||
"geometricError" : 2.0, | ||
"children": [ | ||
{ | ||
"geometricError" : 1.0, | ||
"boundingVolume" : { | ||
"box" : [ 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5 ] | ||
}, | ||
"content": { | ||
"uri": "external.json" | ||
} | ||
} | ||
] | ||
}, | ||
"extensionsUsed": [ | ||
"VENDOR_example_extension" | ||
] | ||
} |
16 changes: 16 additions & 0 deletions
16
specs/data/tilesets/externalTilesetExtensions/declaredInBothContainedInTileset/external.json
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,16 @@ | ||
{ | ||
"asset" : { | ||
"version" : "1.1" | ||
}, | ||
"geometricError" : 4.0, | ||
"root" : { | ||
"refine": "REPLACE", | ||
"boundingVolume" : { | ||
"box" : [ 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5 ] | ||
}, | ||
"geometricError" : 2.0 | ||
}, | ||
"extensionsUsed": [ | ||
"VENDOR_example_extension" | ||
] | ||
} |
34 changes: 34 additions & 0 deletions
34
specs/data/tilesets/externalTilesetExtensions/declaredInBothContainedInTileset/tileset.json
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,34 @@ | ||
{ | ||
"asset" : { | ||
"version" : "1.1" | ||
}, | ||
"geometricError" : 4.0, | ||
"root" : { | ||
"refine": "REPLACE", | ||
"boundingVolume" : { | ||
"box" : [ 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5 ] | ||
}, | ||
"geometricError" : 2.0, | ||
"children": [ | ||
{ | ||
"geometricError" : 1.0, | ||
"boundingVolume" : { | ||
"box" : [ 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5 ] | ||
}, | ||
"content": { | ||
"uri": "external.json" | ||
} | ||
} | ||
] | ||
}, | ||
"extensionsUsed": [ | ||
"VENDOR_example_extension" | ||
], | ||
"extensions": { | ||
"VENDOR_example_extension": { | ||
"exampleExtension": { | ||
"description": "A dummy example extension" | ||
} | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...ta/tilesets/externalTilesetExtensions/declaredInExternalContainedInExternal/external.json
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,23 @@ | ||
{ | ||
"asset" : { | ||
"version" : "1.1" | ||
}, | ||
"geometricError" : 4.0, | ||
"root" : { | ||
"refine": "REPLACE", | ||
"boundingVolume" : { | ||
"box" : [ 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5 ] | ||
}, | ||
"geometricError" : 2.0 | ||
}, | ||
"extensionsUsed": [ | ||
"VENDOR_example_extension" | ||
], | ||
"extensions": { | ||
"VENDOR_example_extension": { | ||
"exampleExtension": { | ||
"description": "A dummy example extension" | ||
} | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...ata/tilesets/externalTilesetExtensions/declaredInExternalContainedInExternal/tileset.json
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,24 @@ | ||
{ | ||
"asset" : { | ||
"version" : "1.1" | ||
}, | ||
"geometricError" : 4.0, | ||
"root" : { | ||
"refine": "REPLACE", | ||
"boundingVolume" : { | ||
"box" : [ 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5 ] | ||
}, | ||
"geometricError" : 2.0, | ||
"children": [ | ||
{ | ||
"geometricError" : 1.0, | ||
"boundingVolume" : { | ||
"box" : [ 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5 ] | ||
}, | ||
"content": { | ||
"uri": "external.json" | ||
} | ||
} | ||
] | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...ata/tilesets/externalTilesetExtensions/declaredInExternalContainedInTileset/external.json
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,16 @@ | ||
{ | ||
"asset" : { | ||
"version" : "1.1" | ||
}, | ||
"geometricError" : 4.0, | ||
"root" : { | ||
"refine": "REPLACE", | ||
"boundingVolume" : { | ||
"box" : [ 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5 ] | ||
}, | ||
"geometricError" : 2.0 | ||
}, | ||
"extensionsUsed": [ | ||
"VENDOR_example_extension" | ||
] | ||
} |
31 changes: 31 additions & 0 deletions
31
...data/tilesets/externalTilesetExtensions/declaredInExternalContainedInTileset/tileset.json
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,31 @@ | ||
{ | ||
"asset" : { | ||
"version" : "1.1" | ||
}, | ||
"geometricError" : 4.0, | ||
"root" : { | ||
"refine": "REPLACE", | ||
"boundingVolume" : { | ||
"box" : [ 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5 ] | ||
}, | ||
"geometricError" : 2.0, | ||
"children": [ | ||
{ | ||
"geometricError" : 1.0, | ||
"boundingVolume" : { | ||
"box" : [ 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5 ] | ||
}, | ||
"content": { | ||
"uri": "external.json" | ||
} | ||
} | ||
] | ||
}, | ||
"extensions": { | ||
"VENDOR_example_extension": { | ||
"exampleExtension": { | ||
"description": "A dummy example extension" | ||
} | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...s/data/tilesets/externalTilesetExtensions/declaredInNoneContainedInExternal/external.json
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,20 @@ | ||
{ | ||
"asset" : { | ||
"version" : "1.1" | ||
}, | ||
"geometricError" : 4.0, | ||
"root" : { | ||
"refine": "REPLACE", | ||
"boundingVolume" : { | ||
"box" : [ 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5 ] | ||
}, | ||
"geometricError" : 2.0 | ||
}, | ||
"extensions": { | ||
"VENDOR_example_extension": { | ||
"exampleExtension": { | ||
"description": "A dummy example extension" | ||
} | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
specs/data/tilesets/externalTilesetExtensions/declaredInNoneContainedInExternal/tileset.json
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,24 @@ | ||
{ | ||
"asset" : { | ||
"version" : "1.1" | ||
}, | ||
"geometricError" : 4.0, | ||
"root" : { | ||
"refine": "REPLACE", | ||
"boundingVolume" : { | ||
"box" : [ 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5 ] | ||
}, | ||
"geometricError" : 2.0, | ||
"children": [ | ||
{ | ||
"geometricError" : 1.0, | ||
"boundingVolume" : { | ||
"box" : [ 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5 ] | ||
}, | ||
"content": { | ||
"uri": "external.json" | ||
} | ||
} | ||
] | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...ata/tilesets/externalTilesetExtensions/declaredInTilesetContainedInExternal/external.json
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,20 @@ | ||
{ | ||
"asset" : { | ||
"version" : "1.1" | ||
}, | ||
"geometricError" : 4.0, | ||
"root" : { | ||
"refine": "REPLACE", | ||
"boundingVolume" : { | ||
"box" : [ 0.5, 0.5, 0.5, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5 ] | ||
}, | ||
"geometricError" : 2.0 | ||
}, | ||
"extensions": { | ||
"VENDOR_example_extension": { | ||
"exampleExtension": { | ||
"description": "A dummy example extension" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.