-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
Support device names with underscores (such as 'Default_Monitor') in JSONHelpers.isValidDeviceId #1826
Support device names with underscores (such as 'Default_Monitor') in JSONHelpers.isValidDeviceId #1826
Conversation
…') in JSONHelpers.isValidDeviceId
@@ -1011,7 +1017,7 @@ namespace FancyZonesUnitTests | |||
for (int i = 0; i < 10; i++) | |||
{ | |||
json::JsonObject obj = json::JsonObject::Parse(m_defaultCustomDeviceStr); | |||
obj.SetNamedValue(L"device-id", json::JsonValue::CreateStringValue(std::to_wstring(i) + L"_1920_1200_{39B25DD2-130D-4B5D-8851-4791D66B1539}")); | |||
obj.SetNamedValue(L"device-id", json::JsonValue::CreateStringValue(std::to_wstring(i) + L"#_1920_1200_{39B25DD2-130D-4B5D-8851-4791D66B1539}")); |
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.
Please see #1827
We can't force the #
to be present since it is currently supported and several users may have it without it.
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.
Is a device id without # actually a real-case scenario? I am happy to search for #, and only then use that logic.
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.
Yes, it's a real case scenario as you can see in this issue #1777 (comment), where Windows fails to return a proper ID for a connected monitor.
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.
Pushed a fix.
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.
Excellent!
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.
Tested and it works as expected.
Thank you very much for fixing this!
Perhaps you should add a test like this:
|
@ivan100sic |
Nice work! Works as expected! |
@GeertvanHorrik if you can add the suggested test it would be great, but we can also add it after the PR is merged. We would like to merge it today. |
Will do it now. |
Done, ready for another review. |
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 job! I like the extra test you added.
Summary of the Pull Request
Fixes #1821
References
I think this could be related to #1807
PR Checklist
Detailed Description of the Pull Request / Additional comments
Fixes the JSONHelper::isValidDeviceId by splitting the first section on the '#' instead of by '_'. This allows to use underscores in monitor device names.
Validation Steps Performed