-
Notifications
You must be signed in to change notification settings - Fork 88
Make EdgePicker_DoesNotPickEdge_BothPointsBehindCamera ignore expected asserts #637
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
base: master
Are you sure you want to change the base?
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr-agent |
varinotmUnity
left a comment
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.
lgtm. Should we also UnityEngine.TestTools.LogAssert.ignoreFailingMessages = false; in the cleanup of this file, and the facePicker one?
| UnityEngine.TestTools.LogAssert.ignoreFailingMessages = true; | ||
| EditorSceneViewPicker.DoMouseClick( | ||
| CreateMouseEvent(mousePos, EventType.MouseDown, EventModifiers.None), | ||
| SelectMode.Edge, |
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.
Suggestion: The LogAssert.ignoreFailingMessages flag is a static property that persists across tests. Failing to reset it can cause subsequent tests to unintentionally ignore critical errors. To prevent this side effect, you should restore its original value using a try...finally block, ensuring it's always reset even if the test action throws an exception. [possible issue, importance: 9]
New proposed code:
+var previousIgnoreFailingMessages = UnityEngine.TestTools.LogAssert.ignoreFailingMessages;
UnityEngine.TestTools.LogAssert.ignoreFailingMessages = true;
-EditorSceneViewPicker.DoMouseClick(
- CreateMouseEvent(mousePos, EventType.MouseDown, EventModifiers.None),
- SelectMode.Edge,
- m_PickerPreferences);
+try
+{
+ EditorSceneViewPicker.DoMouseClick(
+ CreateMouseEvent(mousePos, EventType.MouseDown, EventModifiers.None),
+ SelectMode.Edge,
+ m_PickerPreferences);
+}
+finally
+{
+ UnityEngine.TestTools.LogAssert.ignoreFailingMessages = previousIgnoreFailingMessages;
+}🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr-agent
|
|
||
| UnityEngine.TestTools.LogAssert.Expect("Handles.GetClosestPickingID called outside an editor OnGUI"); | ||
| UnityEngine.TestTools.LogAssert.Expect("Assertion failed on expression: 'device.IsInsideFrame()'"); | ||
| UnityEngine.TestTools.LogAssert.ignoreFailingMessages = true; |
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.
Suggestion: Using LogAssert.ignoreFailingMessages = true is risky as it can hide new, unexpected errors, reducing the test's effectiveness. A more robust approach is to explicitly declare the expected log messages using LogAssert.Expect. The original approach was likely failing because the LogType was not specified; assertion failures, for example, should be expected with LogType.Assert. [general, importance: 10]
| UnityEngine.TestTools.LogAssert.ignoreFailingMessages = true; | |
| // Please adjust the LogType to match the actual log message type. | |
| UnityEngine.TestTools.LogAssert.Expect(LogType.Warning, "Handles.GetClosestPickingID called outside an editor OnGUI"); | |
| UnityEngine.TestTools.LogAssert.Expect(LogType.Assert, "Assertion failed on expression: 'device.IsInsideFrame()'"); |
🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr-agent
Codecov ReportAll modified and coverable lines are covered by tests ✅ @@ Coverage Diff @@
## master #637 +/- ##
=======================================
Coverage 35.55% 35.55%
=======================================
Files 277 277
Lines 34889 34889
=======================================
Hits 12406 12406
Misses 22483 22483 🚀 New features to boost your workflow:
|
Purpose of this PR
[Brief summary of the changes in this PR.]
Links
Jira:
Comments to Reviewers
[List known issues, planned work, provide any extra context for your code.]