| <html> |
| <head> |
| <script src="../../resources/js-test.js"></script> |
| </head> |
| <body id="body"> |
| |
| <input id="range1" type="range"> |
| |
| <p id="description"></p> |
| <div id="console"></div> |
| <div id="notifications"></div> |
| |
| <script> |
| |
| description("This tests that a basic range returns all the correct information for the gtk platform."); |
| |
| var range = 0; |
| var valueChangeCount = 0; |
| function notificationCallback(notification) { |
| if (notification == "AXValueChanged") { |
| document.getElementById("notifications").innerHTML += "Successfully received " + notification + "<br>"; |
| valueChangeCount++; |
| } |
| |
| if (valueChangeCount == 4) { |
| range.removeNotificationListener(); |
| finishJSTest(); |
| } |
| } |
| |
| if (window.accessibilityController) { |
| jsTestIsAsync = true; |
| |
| document.getElementById("range1").focus(); |
| range = accessibilityController.focusedElement; |
| range.addNotificationListener(notificationCallback); |
| |
| // Check that min/max/value return correct default values. |
| shouldBe("range.minValue", "0"); |
| shouldBe("range.maxValue", "100"); |
| shouldBe("range.intValue", "50"); |
| |
| // Check that incrementing/decrementing with the keyboard sends AXValueChange. |
| eventSender.keyDown("leftArrow"); |
| shouldBe("range.intValue", "49"); |
| |
| eventSender.keyDown("rightArrow"); |
| shouldBe("range.intValue", "50"); |
| |
| // Check that incrementing/decrementing with accessibility API sends AXValueChange. |
| range.increment(); |
| shouldBe("range.intValue", "55"); |
| |
| range.decrement(); |
| shouldBe("range.intValue", "50"); |
| |
| // Check that outside the indicator returns the slider. |
| var hitTestRange = accessibilityController.elementAtPoint(range.x + 1, range.y + range.height/2); |
| shouldBeTrue("range.isEqual(hitTestRange)"); |
| } |
| |
| </script> |
| </body> |
| </html> |