| <html> |
| <!-- |
| This test ensures the correctness of the "Fully aligned" precedence |
| logic implemented by Spatial Navigation algorithm in an horizontal direction: |
| targets whose middle falls between the top and bottom of the current focused |
| element are preferably to move focus to, even if it is not the shortest distance. |
| |
| * Pre-conditions: |
| 1) DRT support for SNav enable/disable. |
| |
| * Navigation steps: |
| 1) Loads this page, focus goes to "start" automatically. |
| 2) Focus moves preferably to elements right up or above the |
| current focused element, even when there are some other closer |
| but not vertically aligned elements in the same direction. |
| --> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| <script src="resources/spatial-navigation-utils.js"></script> |
| <script type="application/javascript"> |
| |
| var resultMap = [ |
| ["Down", "1"], |
| ["Right", "2"], |
| ["Down", "4"], |
| ["Left", "3"], |
| ["Down", "5"], |
| ["Right", "6"], |
| ["Down", "8"], |
| ["Left", "7"], |
| ["Down", "9"], |
| ["Right", "10"], |
| ["Down", "12"], |
| ["Left", "11"], |
| ["Down", "13"], |
| ["Right", "14"], |
| ["Down", "16"], |
| ["Left", "15"], |
| ["Down", "17"], |
| ["Right", "18"], |
| ["Down", "20"], |
| ["Left", "19"], |
| ["Down", "21"], |
| ["Right", "22"], |
| ["Down", "24"], |
| ["Left", "23"], |
| ["Down", "25"], |
| ["Right", "26"], |
| ["Down", "27"], |
| ["Down", "end"], |
| ["DONE", "DONE"] |
| ]; |
| |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.setSpatialNavigationEnabled(true); |
| testRunner.overridePreference("WebKitTabToLinksPreferenceKey", 1); |
| testRunner.waitUntilDone(); |
| } |
| |
| function runTest() |
| { |
| // starting the test itself: get to a known place. |
| document.getElementById("start").focus(); |
| |
| initTest(resultMap, testCompleted); |
| } |
| |
| function testCompleted() |
| { |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| } |
| |
| window.onload = runTest; |
| </script> |
| <script src="../resources/js-test-post.js"></script> |
| </head> |
| <body id="some-content" xmlns="http://www.w3.org/1999/xhtml"> |
| <a id="start" href="a">test<br></a> |
| <a id="1" href="a">H</a> <a id="2" href="p">ow Now Brown Cow</a><br> |
| <a id="3" href="a">Ho</a> <a id="4" href="p">w Now Brown Cow</a><br> |
| <a id="5" href="a">How</a> <a id="6" href="p">Now Brown Cow</a><br> |
| <a id="7" href="a">How N</a> <a id="8" href="p">ow Brown Cow</a><br> |
| <a id="9" href="a">How No</a> <a id="10" href="p">w Brown Cow</a><br> |
| <a id="11" href="a">How Now </a> <a id="12" href="p">Brown Cow</a><br> |
| <a id="13" href="a">How Now B</a> <a id="14" href="p">rown Cow</a><br> |
| <a id="15" href="a">How Now Br</a> <a id="16" href="p">own Cow</a><br> |
| <a id="17" href="a">How Now Bro</a> <a id="18" href="p">wn Cow</a><br> |
| <a id="19" href="a">How Now Brow</a> <a id="20" href="p">n Cow</a><br> |
| <a id="21" href="a">How Now Brown</a> <a id="22" href="p">Cow</a><br> |
| <a id="23" href="a">How Now Brown C</a> <a id="24" href="p">ow</a><br> |
| <a id="25" href="a">How Now Brown Co</a> <a id="26" href="p">w</a><br> |
| <a id="27" href="a">How Now Brown Cow</a><br><br> |
| <a id="end" href="a">test<br></a> |
| <div id="console"></div> |
| </body> |
| </html> |
| |