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
8264162: PickResult.toString() is missing the closing square bracket #443
8264162: PickResult.toString() is missing the closing square bracket #443
Conversation
👋 Welcome back kcr! A progress list of the required criteria for merging this PR into |
Webrevs
|
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.
Good catch. Test fails before and succeeds after the patch.
@kevinrushforth This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 2 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
@@ -203,6 +203,7 @@ public String toString() { | |||
if (getIntersectedTexCoord() != null) { | |||
sb.append(", texCoord = ").append(getIntersectedTexCoord()); |
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 fix the double indentation in the if
bodies?
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.
Sure, as long as I am there, I'll do that.
break; | ||
case ']': | ||
--bracketCount; | ||
assertTrue("Too many closing brackets: " + str, bracketCount >= 0); |
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.
This test can fail due to a malformed toString
result in the node (getIntersectedNode()
), which I would think is outside the scope of this test. In practice, this test's result is dependent on what node I choose to test.
Shouldn't we be testing the structure of the string and not its contents?
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.
On the one hand, I can see your point that it's somewhat tangential that Rectangle has matched brackets, but you could say the same about the Point3D. Here is the result of MouseEvent.toString for the test:
MouseEvent [source = javafx.event.Event$$Lambda$110/0x0000000800c52fa8@461111c0,
target = javafx.event.Event$$Lambda$110/0x0000000800c52fa8@461111c0, eventType = MOUSE_PRESSED,
consumed = false, x = 18.0, y = 27.0, z = 150.0, button = PRIMARY, primaryButtonDown,
pickResult = PickResult [node = Rectangle[x=0.0, y=0.0, width=0.0, height=0.0, fill=0x000000ff],
point = Point3D [x = 15.0, y = 25.0, z = 100.0], distance = 33.0]]
The test would be more complicated if it were changed to ignore the results of the toString()
of both the intersected node and the point. If I were to go down this path, I would likely just change it to do match a regex of "^MouseEvent \[.*PickResult \[.*\]\]$"
, which would be simple. Do you think it's worth it?
Maybe instead I could add a comment that this test checks for matching brackets in the entire composed string returned by MouseEvent::toString
, including PickResult::toString
, which in turn includes Node::toString
for the intersected node?
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 don't think it matters too much, but a change in any of the classes used here could break this test, which is a bit off. I will be satisfied with a comment warning about this case so if it breaks it will be easy to see where the problem is.
By the way, this class could easily be converted to a |
Converting an existing class to a Record wouldn't be backward compatible (not to mention we can't use them yet). It wouldn't help for the Node::toString portion in any case. I'll add the comment and send out a new version. |
… comment to the test
/integrate |
@kevinrushforth Since your change was applied there have been 2 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit f3e27a0. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Simple fix to add a missing closing bracket to
PickResult::toString
. This includes a unit test that fails without the fix and passes with the fix.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jfx pull/443/head:pull/443
$ git checkout pull/443
Update a local copy of the PR:
$ git checkout pull/443
$ git pull https://git.openjdk.java.net/jfx pull/443/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 443
View PR using the GUI difftool:
$ git pr show -t 443
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jfx/pull/443.diff