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
rest-api: When finding table items by cell value, ignore BiDi control chars #33
Conversation
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.
Now we'll have to rely on our QA people to check this in the real openQA machinery.
fb871c7
to
60a05ad
Compare
60a05ad
to
3030d7c
Compare
@@ -90,7 +90,7 @@ YTableActionHandler::table_findItem( std::vector<std::string>::const_iterator pa | |||
if ( ! item ) | |||
return nullptr; | |||
|
|||
if ( item->label(column_id) == *path_begin ) | |||
if ( normalize_label ( item->label(column_id) ) == *path_begin ) |
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 is the actual 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.
It took me a while to understand how that remove_if()
works (in true STL manner, designed in a mathematically correct way, but not at all practically oriented, let alone easy to understand; that's why I prefer Qt's string and container classes), but now that I got that,
LGTM.
In yast/yast-storage-ng#873 I have fixed displaying filesystem paths in partitioner table widgets in right to left languages, by adding invisible BiDirectional control characters to the paths (which Qt then interprets and lays out the text correctly).
Part of that was adjusting the unit tests that were comparing table cell values to cope with the added characters and strip them off before comparing with expected values. What I haven't expected, similar comparisons are done by production code, namely here by libyui-rest-api when choosing widgets and their items by their text values.
The fix is to strip the BiDi control characters before the comparison.
openQA includes an automated test. Here is a manual test:
&
keyboard shortcut marker in widget labels. This PR should take that into account and use similar code.