REGRESSION(r184899): Crash when focusing an input element styled with a web font
[WebKit-https.git] / LayoutTests / platform / mac / accessibility / value-change-userinfo.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4     <script src="../../../resources/js-test-pre.js"></script>
5     <script src="../../../editing/editing.js"></script>
6 </head>
7 <body id="body">
8
9     <div role="textbox" tabindex=0 id="textbox" contenteditable=true>01234567890</div>
10
11     <p id="description"></p>
12     <div id="console"></div>
13     <div id="notifications"></div>
14
15     <script>
16
17         description("This tests value change notifications user info data.");
18
19         var AXTextStateChangeTypeEdit = 1;
20
21         var AXTextEditTypeDelete = 1;
22         var AXTextEditTypeInsert = AXTextEditTypeDelete + 1;
23         var AXTextEditTypeTyping = AXTextEditTypeInsert + 1;
24         var AXTextEditTypeDictation = AXTextEditTypeTyping + 1;
25         var AXTextEditTypeCut = AXTextEditTypeDictation + 1
26         var AXTextEditTypePaste = AXTextEditTypeCut + 1;
27
28         var webArea = 0;
29         var count = 0;
30         var results = [];
31         var resultIndex = 0;
32         function notificationCallback(notification, userInfo) {
33             if (notification == "AXValueChanged") {
34                 count++;
35                 results.push(userInfo);
36                 if (count == 6) {
37
38                     shouldBe("results[resultIndex][\"AXTextStateChangeType\"]", "AXTextStateChangeTypeEdit");
39                     shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextChangeValue\"]", "\"0\"");
40                     shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextEditType\"]", "AXTextEditTypeCut");
41
42                     resultIndex++;
43                     shouldBe("results[resultIndex][\"AXTextStateChangeType\"]", "AXTextStateChangeTypeEdit");
44                     shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextChangeValue\"]", "\"1\"");
45                     shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextEditType\"]", "AXTextEditTypeDelete");
46
47                     resultIndex++;
48                     shouldBe("results[resultIndex][\"AXTextStateChangeType\"]", "AXTextStateChangeTypeEdit");
49                     shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextChangeValue\"]", "\"0\"");
50                     shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextEditType\"]", "AXTextEditTypePaste");
51
52                     resultIndex++;
53                     shouldBe("results[resultIndex][\"AXTextStateChangeType\"]", "AXTextStateChangeTypeEdit");
54                     shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextChangeValue\"]", "\"234567890\"");
55                     shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextEditType\"]", "AXTextEditTypePaste");
56
57                     resultIndex++;
58                     shouldBe("results[resultIndex][\"AXTextStateChangeType\"]", "AXTextStateChangeTypeEdit");
59                     shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextChangeValue\"]", "\"1\"");
60                     shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextEditType\"]", "AXTextEditTypeTyping");
61
62                     resultIndex++;
63                     shouldBe("results[resultIndex][\"AXTextStateChangeType\"]", "AXTextStateChangeTypeEdit");
64                     shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextChangeValue\"]", "\"1\"");
65                     shouldBe("results[resultIndex][\"AXTextChangeValues\"][0][\"AXTextEditType\"]", "AXTextEditTypeDelete");
66
67                     webArea.removeNotificationListener();
68                     window.testRunner.notifyDone();
69                 }
70             }
71         }
72
73         if (window.accessibilityController) {
74              window.testRunner.waitUntilDone();
75
76             accessibilityController.enableEnhancedAccessibility(true);
77
78             webArea = accessibilityController.rootElement.childAtIndex(0);
79             var addedNotification = webArea.addNotificationListener(notificationCallback);
80             shouldBe("addedNotification", "true");
81
82             var textbox = document.getElementById("textbox");
83             textbox.focus();
84
85             execSetSelectionCommand(textbox, 0);
86             execExtendSelectionRightByCharacterCommand();
87             cutCommand();
88             execExtendSelectionRightByCharacterCommand();
89             pasteCommand();
90             eventSender.keyDown("1");
91             deleteCommand();
92         }
93     </script>
94
95     <script src="../../../resources/js-test-post.js"></script>
96 </body>
97 </html>