Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate i3dm header #27

Closed
wants to merge 14 commits into from
Closed

Validate i3dm header #27

wants to merge 14 commits into from

Conversation

JudyWeng
Copy link
Contributor

@JudyWeng JudyWeng commented Nov 2, 2016

#22
I've ran jsDoc, jsHint, and the tests and everything seems fine so far. I usually test every unit test possible, and therefore made 2 valid i2dm tiles with the different gITF formats. Please let me know if I should just keep it to 1 valid tile instead or if anything else needs to be changed.

Copy link
Contributor

@lilleyse lilleyse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests look great! Checking both the url and embedded is definitely the right approach.


return {
result : true,
message: 'Tile is a valid ib3m tile ' + gltfFormatMsg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ib3m -> i3dm

I think it's fine to not append the "with gltf format as a url" / "with gltf format as an embedded binary gITF" message.

result : true,
message: 'Tile is a valid ib3m tile ' + gltfFormatMsg
};
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add newline.


describe('validateI3dm', function() {

it('returns true if the i3dm tile is valid, returns false if the i3dm has invalid magic', function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the "returns true if the i3dm tile is valid" part from these descriptions.

it('returns true if i3dm matches spec with glTF field of the body being a url', function() {
var validatorObject = validateI3dm(createI3dmTileGltfUrl());
var message = validatorObject.message;
expect(validatorObject.result && message.includes("url")).toBe(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use single quotes for strings. Shows up in a few other places as well.

expect(validatorObject.result && message.includes("url")).toBe(true);
});

it('returns true if i3dm matches spec with glTF field of the body being an embedded binary glTF', function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wording here can be simplified to something like:

validates an i3dm with an embedded binary glTF. Same with the url test.

Like above, it's fine not to check the message.

header.writeUInt32LE(5, 28); // gltfFormat: invalid

return header;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add newline.

var byteLength = content.readUInt32LE(8);
var gltfFormat = content.readUInt32LE(28);

var gltfFormatMsg = "";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throughout use single quotes. Check out the Coding Guide for the conventions we use.


if (gltfFormat === 0) {
} else if (gltfFormat === 1) {
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be cleaner as:
if (gltfFormat !== 0 && gltfFormat !== 1) {

result : true,
message: 'valid'
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove empty line

message: 'valid'
};

}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add newline.

var validateI3dm = require('../../lib/validateI3dm');

describe('validateI3dm', function() {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove empty line.

header.writeUInt32LE(0, 28); // gltfFormat: 0 - url

return header;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove empty line.

header.writeUInt32LE(0, 28); // gltfFormat: 0 - url

return header;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove empty line.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment for the other 2 functions.

@lilleyse
Copy link
Contributor

lilleyse commented Nov 7, 2016

Some old commits from the b3dm validation seemed to have gotten merged incorrectly into here. Can you remove those?

Also make sure to leave a quick comment when the PR is ready for me to review.

This looks good! Just these new comments.

@JudyWeng
Copy link
Contributor Author

JudyWeng commented Nov 9, 2016

Hey Sean, I think the previous b3dm validation commits are here because it automatically rebases when I pull and I usually pull from the validator-master branch. Am I not supposed to be pulling from the validator-master branch while I work on these lib files? And how would I go about removing the old commits that already got duplicated here? I haven't pushed my new local changes yet just in case it complicates things.

@lilleyse
Copy link
Contributor

lilleyse commented Nov 9, 2016

I'm not sure why rebase isn't working as expected. Personally, I almost always do git merge instead if I need to update my branch with master.

To remove the commits you can try doing an interactive rebase.

@JudyWeng
Copy link
Contributor Author

I tried to use the interactive rebase to drop the additional commits that got added and pushed, but it seemed to add a lot of the older validateB3dm commits instead.

@JudyWeng JudyWeng mentioned this pull request Nov 11, 2016
@lilleyse
Copy link
Contributor

Hm ok, we can work through this later today.

JudyWeng added a commit that referenced this pull request Nov 12, 2016
@JudyWeng
Copy link
Contributor Author

JudyWeng commented Nov 12, 2016

closed in favor of #31

@JudyWeng JudyWeng closed this Nov 12, 2016
@JudyWeng JudyWeng mentioned this pull request Nov 12, 2016
@lilleyse lilleyse deleted the validate-i3dm branch November 15, 2016 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants