BidiChecker (http://code.google.com/p/bidichecker) is a tool for the automated testing of web pages for errors in support of right-to-left (RTL) languages (such as Arabic and Hebrew), also known as bidirectional (BiDi) because they routinely include left-to-right items such as numbers and Latin-script words and phrases.
BiDi support for a web page is a common requirement, even for pages in left-to-right scripts. Any page which accepts user input or displays multilingual content is likely to end up handling bidirectional text at some point, as it will eventually encounter data in Arabic, Hebrew or another RTL language. Unfortunately, handling bidirectional text can be tricky and requires special processing at every appearance of potentially BiDi data in the UI. (Examples of common BiDi UI bugs can be found here.) As a result, BiDi text support often regresses when a developer adds a new feature and simply forgets about BiDi.
BidiChecker and Chrome
Chrome has a mechanism called WebUI, which displays parts of the Chrome UI using web content (e.g. Chrome's preferences). BidiChecker can automatically test such pages for common BiDi errors, and report any regressions. Currently, BidiChecker is being run as part of Chrome's standard unit test suite.
Adding BidiChecker Tests for your WebUI page
There are two cases which BidiChecker is used to verify:
Your page needs to test for both cases. Luckily this is really simple:
Note: As a convention, you should name your test with the same name both for RTL and LTR.
Handling BidiChecker Errors
After first running your tests, it's possible that BidiChecker will find errors in your page. When this happens you have two options:
Running BidiChecker Tests
BidiChecker tests are being run as part of the browser_tests executable. If you want to execute only the BidiChecker tests, run
To run only a specific BidiChecker test use
What Should I Test For?
BidiChecker tests are usually very good at catching errors in mixed directionality UIs. As such, you should try to test your page with content that has the opposite directionality from the active language (e.g. Hebrew text entered into a en-us localized page). Common examples are: