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
Add tests for WebGLRenderLists, WebGLRenderList #19346
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c2c73d1
Add tests
gkjohnson 14cce39
add sort test
gkjohnson 921cfea
Add "finish" test
gkjohnson 49d611b
Merge remote-tracking branch 'mrdoob/dev' into webglrenderlists-tests
gkjohnson c3698cb
Make requested comment and change for `renderItems`
gkjohnson add8912
remove renderItems from webglrenderlists typescript definition
gkjohnson 1f3e799
comment out finish test, remove exposed render items field
gkjohnson File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we had this before (meaning making something public so it is accessible for unit tests).
@mrdoob Do we need to update the TS declaration file in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... I feel like it's worth it.
I don't know. @gkjohnson what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about this tonight and have a concern.
Unit tests should focus on testing the public interface of a component. It's not ideal if internals have to be exposed in order to write "better" unit tests. In general, unit tests should make no assumption about the implementation. Otherwise you have to refactor unit tests when internals change, even if the public interface stays the same.
Hence, I think it's better to not expose
renderItems
andWebGLRenderList
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally I agree but in this case
finish
can't really be tested otherwise because it has important behavior that otherwise isn't testable from the outside the class -- it's intended to remove references to objects so they can be garbage collected and I think it's valuable to make sure that's working right. If you have other suggestions on how to check that otherwise I'm happy to try another approach!I think the typescript definitions files are only really useful for classes and members that we expect people to use publicly (it's really just useful for autocomplete and typescript error reporting) so I don't think we need to include it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we make these methods public temporarily?
And we add comments in the code to communicate that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain what you mean by that? "Temporarily" as in "we'll make them public and see how it goes" and maybe remove them later? Either way I'll add
WebGLRenderList
andrenderItems
to the typescript definitions and add a comment saying they were made public for the sake of testing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're making them public so you can get
Group.renderOrder
fixed. Once it's fixed we can make them private again.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you want to remove the tests for the
finish
function later, then? To me it makes sense to keep those tests to make sure thatfinish
function doesn't silently break in the future but I'm supportive either way. I've gone ahead and added the comment addedrenderItems
to the typescript definitions.