mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
176fdc3ff9
--HG-- rename : toolkit/content/tests/widgets/frame_popupremoving_frame.xul => toolkit/content/tests/chrome/frame_popupremoving_frame.xul rename : toolkit/content/tests/widgets/popup_childframe_node.xul => toolkit/content/tests/chrome/popup_childframe_node.xul rename : toolkit/content/tests/widgets/popup_trigger.js => toolkit/content/tests/chrome/popup_trigger.js rename : toolkit/content/tests/widgets/test_bug360220.xul => toolkit/content/tests/chrome/test_bug360220.xul rename : toolkit/content/tests/widgets/test_bug365773.xul => toolkit/content/tests/chrome/test_bug365773.xul rename : toolkit/content/tests/widgets/test_bug382990.xul => toolkit/content/tests/chrome/test_bug382990.xul rename : toolkit/content/tests/widgets/test_bug457632.xul => toolkit/content/tests/chrome/test_bug457632.xul rename : toolkit/content/tests/widgets/test_bug460942.xul => toolkit/content/tests/chrome/test_bug460942.xul rename : toolkit/content/tests/widgets/test_bug509732.xul => toolkit/content/tests/chrome/test_bug509732.xul rename : toolkit/content/tests/widgets/test_bug554279.xul => toolkit/content/tests/chrome/test_bug554279.xul rename : toolkit/content/tests/widgets/test_bug557987.xul => toolkit/content/tests/chrome/test_bug557987.xul rename : toolkit/content/tests/widgets/test_bug562554.xul => toolkit/content/tests/chrome/test_bug562554.xul rename : toolkit/content/tests/widgets/test_button.xul => toolkit/content/tests/chrome/test_button.xul rename : toolkit/content/tests/widgets/test_closemenu_attribute.xul => toolkit/content/tests/chrome/test_closemenu_attribute.xul rename : toolkit/content/tests/widgets/test_colorpicker_popup.xul => toolkit/content/tests/chrome/test_colorpicker_popup.xul rename : toolkit/content/tests/widgets/test_contextmenu_list.xul => toolkit/content/tests/chrome/test_contextmenu_list.xul rename : toolkit/content/tests/widgets/test_focus_anons.xul => toolkit/content/tests/chrome/test_focus_anons.xul rename : toolkit/content/tests/widgets/test_hiddenitems.xul => toolkit/content/tests/chrome/test_hiddenitems.xul rename : toolkit/content/tests/widgets/test_hiddenpaging.xul => toolkit/content/tests/chrome/test_hiddenpaging.xul rename : toolkit/content/tests/widgets/test_menu.xul => toolkit/content/tests/chrome/test_menu.xul rename : toolkit/content/tests/widgets/test_menu_hide.xul => toolkit/content/tests/chrome/test_menu_hide.xul rename : toolkit/content/tests/widgets/test_menuitem_blink.xul => toolkit/content/tests/chrome/test_menuitem_blink.xul rename : toolkit/content/tests/widgets/test_menulist.xul => toolkit/content/tests/chrome/test_menulist.xul rename : toolkit/content/tests/widgets/test_menulist_keynav.xul => toolkit/content/tests/chrome/test_menulist_keynav.xul rename : toolkit/content/tests/widgets/test_notificationbox.xul => toolkit/content/tests/chrome/test_notificationbox.xul rename : toolkit/content/tests/widgets/test_panelfrommenu.xul => toolkit/content/tests/chrome/test_panelfrommenu.xul rename : toolkit/content/tests/widgets/test_popup_attribute.xul => toolkit/content/tests/chrome/test_popup_attribute.xul rename : toolkit/content/tests/widgets/test_popup_button.xul => toolkit/content/tests/chrome/test_popup_button.xul rename : toolkit/content/tests/widgets/test_popup_coords.xul => toolkit/content/tests/chrome/test_popup_coords.xul rename : toolkit/content/tests/widgets/test_popup_keys.xul => toolkit/content/tests/chrome/test_popup_keys.xul rename : toolkit/content/tests/widgets/test_popup_preventdefault.xul => toolkit/content/tests/chrome/test_popup_preventdefault.xul rename : toolkit/content/tests/widgets/test_popup_recreate.xul => toolkit/content/tests/chrome/test_popup_recreate.xul rename : toolkit/content/tests/widgets/test_popup_scaled.xul => toolkit/content/tests/chrome/test_popup_scaled.xul rename : toolkit/content/tests/widgets/test_popup_tree.xul => toolkit/content/tests/chrome/test_popup_tree.xul rename : toolkit/content/tests/widgets/test_popuphidden.xul => toolkit/content/tests/chrome/test_popuphidden.xul rename : toolkit/content/tests/widgets/test_popupincontent.xul => toolkit/content/tests/chrome/test_popupincontent.xul rename : toolkit/content/tests/widgets/test_popupremoving.xul => toolkit/content/tests/chrome/test_popupremoving.xul rename : toolkit/content/tests/widgets/test_popupremoving_frame.xul => toolkit/content/tests/chrome/test_popupremoving_frame.xul rename : toolkit/content/tests/widgets/test_position.xul => toolkit/content/tests/chrome/test_position.xul rename : toolkit/content/tests/widgets/test_progressmeter.xul => toolkit/content/tests/chrome/test_progressmeter.xul rename : toolkit/content/tests/widgets/test_props.xul => toolkit/content/tests/chrome/test_props.xul rename : toolkit/content/tests/widgets/test_radio.xul => toolkit/content/tests/chrome/test_radio.xul rename : toolkit/content/tests/widgets/test_richlist_direction.xul => toolkit/content/tests/chrome/test_richlist_direction.xul rename : toolkit/content/tests/widgets/test_scale.xul => toolkit/content/tests/chrome/test_scale.xul rename : toolkit/content/tests/widgets/test_scrollbar.xul => toolkit/content/tests/chrome/test_scrollbar.xul rename : toolkit/content/tests/widgets/test_sorttemplate.xul => toolkit/content/tests/chrome/test_sorttemplate.xul rename : toolkit/content/tests/widgets/test_statusbar.xul => toolkit/content/tests/chrome/test_statusbar.xul rename : toolkit/content/tests/widgets/test_tabbox.xul => toolkit/content/tests/chrome/test_tabbox.xul rename : toolkit/content/tests/widgets/test_tabindex.xul => toolkit/content/tests/chrome/test_tabindex.xul rename : toolkit/content/tests/widgets/test_textbox_emptytext.xul => toolkit/content/tests/chrome/test_textbox_emptytext.xul rename : toolkit/content/tests/widgets/test_textbox_number.xul => toolkit/content/tests/chrome/test_textbox_number.xul rename : toolkit/content/tests/widgets/test_textbox_search.xul => toolkit/content/tests/chrome/test_textbox_search.xul rename : toolkit/content/tests/widgets/test_timepicker.xul => toolkit/content/tests/chrome/test_timepicker.xul rename : toolkit/content/tests/widgets/test_toolbar.xul => toolkit/content/tests/chrome/test_toolbar.xul rename : toolkit/content/tests/widgets/test_tooltip.xul => toolkit/content/tests/chrome/test_tooltip.xul rename : toolkit/content/tests/widgets/test_tooltip_noautohide.xul => toolkit/content/tests/chrome/test_tooltip_noautohide.xul rename : toolkit/content/tests/widgets/test_tree.xul => toolkit/content/tests/chrome/test_tree.xul rename : toolkit/content/tests/widgets/test_tree_single.xul => toolkit/content/tests/chrome/test_tree_single.xul rename : toolkit/content/tests/widgets/test_tree_view.xul => toolkit/content/tests/chrome/test_tree_view.xul rename : toolkit/content/tests/widgets/window_popup_attribute.xul => toolkit/content/tests/chrome/window_popup_attribute.xul rename : toolkit/content/tests/widgets/window_popup_button.xul => toolkit/content/tests/chrome/window_popup_button.xul rename : toolkit/content/tests/widgets/xul_selectcontrol.js => toolkit/content/tests/chrome/xul_selectcontrol.js
180 lines
9.0 KiB
XML
180 lines
9.0 KiB
XML
<?xml version="1.0"?>
|
|
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
|
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
|
<!--
|
|
XUL Widget Test for bug 457632
|
|
-->
|
|
<window title="Bug 457632" width="500" height="600"
|
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
|
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
|
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<notificationbox id="nb"/>
|
|
|
|
<!-- test results are displayed in the html:body -->
|
|
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"
|
|
onload="test()"/>
|
|
|
|
<!-- test code goes here -->
|
|
<script type="application/javascript">
|
|
<![CDATA[
|
|
var gNotificationBox;
|
|
|
|
function completeAnimation(nextTest) {
|
|
if (!gNotificationBox._animating) {
|
|
nextTest();
|
|
return;
|
|
}
|
|
|
|
setTimeout(completeAnimation, 50, nextTest);
|
|
}
|
|
|
|
function test() {
|
|
SimpleTest.waitForExplicitFinish();
|
|
gNotificationBox = document.getElementById("nb");
|
|
|
|
is(gNotificationBox.allNotifications.length, 0, "There should be no initial notifications");
|
|
gNotificationBox.appendNotification("Test notification",
|
|
"notification1", null,
|
|
gNotificationBox.PRIORITY_INFO_LOW,
|
|
null);
|
|
is(gNotificationBox.allNotifications.length, 1, "Notification exists while animating in");
|
|
let notification = gNotificationBox.getNotificationWithValue("notification1");
|
|
ok(notification, "Notification should exist while animating in");
|
|
|
|
// Wait for the notificaton to finish displaying
|
|
completeAnimation(test1);
|
|
}
|
|
|
|
// Tests that a notification that is fully animated in gets removed immediately
|
|
function test1() {
|
|
let notification = gNotificationBox.getNotificationWithValue("notification1");
|
|
gNotificationBox.removeNotification(notification);
|
|
notification = gNotificationBox.getNotificationWithValue("notification1");
|
|
ok(!notification, "Test 1 showed notification was still present");
|
|
ok(!gNotificationBox.currentNotification, "Test 1 said there was still a current notification");
|
|
is(gNotificationBox.allNotifications.length, 0, "Test 1 should show no notifications present");
|
|
|
|
// Wait for the notificaton to finish hiding
|
|
completeAnimation(test2);
|
|
}
|
|
|
|
// Tests that a notification that is animating in gets removed immediately
|
|
function test2() {
|
|
let notification = gNotificationBox.appendNotification("Test notification",
|
|
"notification2", null,
|
|
gNotificationBox.PRIORITY_INFO_LOW,
|
|
null);
|
|
gNotificationBox.removeNotification(notification);
|
|
notification = gNotificationBox.getNotificationWithValue("notification2");
|
|
ok(!notification, "Test 2 showed notification was still present");
|
|
ok(!gNotificationBox.currentNotification, "Test 2 said there was still a current notification");
|
|
is(gNotificationBox.allNotifications.length, 0, "Test 2 should show no notifications present");
|
|
|
|
// Get rid of the hiding notifications
|
|
gNotificationBox.removeAllNotifications(true);
|
|
test3();
|
|
}
|
|
|
|
// Tests that a background notification goes away immediately
|
|
function test3() {
|
|
let notification = gNotificationBox.appendNotification("Test notification",
|
|
"notification3", null,
|
|
gNotificationBox.PRIORITY_INFO_LOW,
|
|
null);
|
|
let notification2 = gNotificationBox.appendNotification("Test notification",
|
|
"notification4", null,
|
|
gNotificationBox.PRIORITY_INFO_LOW,
|
|
null);
|
|
is(gNotificationBox.allNotifications.length, 2, "Test 3 should show 2 notifications present");
|
|
gNotificationBox.removeNotification(notification);
|
|
is(gNotificationBox.allNotifications.length, 1, "Test 3 should show 1 notifications present");
|
|
notification = gNotificationBox.getNotificationWithValue("notification3");
|
|
ok(!notification, "Test 3 showed notification was still present");
|
|
gNotificationBox.removeNotification(notification2);
|
|
is(gNotificationBox.allNotifications.length, 0, "Test 3 should show 0 notifications present");
|
|
notification2 = gNotificationBox.getNotificationWithValue("notification4");
|
|
ok(!notification2, "Test 3 showed notification2 was still present");
|
|
ok(!gNotificationBox.currentNotification, "Test 3 said there was still a current notification");
|
|
|
|
// Get rid of the hiding notifications
|
|
gNotificationBox.removeAllNotifications(true);
|
|
test4();
|
|
}
|
|
|
|
// Tests that a foreground notification hiding a background one goes away
|
|
function test4() {
|
|
let notification = gNotificationBox.appendNotification("Test notification",
|
|
"notification5", null,
|
|
gNotificationBox.PRIORITY_INFO_LOW,
|
|
null);
|
|
let notification2 = gNotificationBox.appendNotification("Test notification",
|
|
"notification6", null,
|
|
gNotificationBox.PRIORITY_INFO_LOW,
|
|
null);
|
|
gNotificationBox.removeNotification(notification2);
|
|
notification2 = gNotificationBox.getNotificationWithValue("notification6");
|
|
ok(!notification2, "Test 4 showed notification2 was still present");
|
|
is(gNotificationBox.currentNotification, notification, "Test 4 said the current notification was wrong");
|
|
is(gNotificationBox.allNotifications.length, 1, "Test 4 should show 1 notifications present");
|
|
gNotificationBox.removeNotification(notification);
|
|
notification = gNotificationBox.getNotificationWithValue("notification5");
|
|
ok(!notification, "Test 4 showed notification was still present");
|
|
ok(!gNotificationBox.currentNotification, "Test 4 said there was still a current notification");
|
|
is(gNotificationBox.allNotifications.length, 0, "Test 4 should show 0 notifications present");
|
|
|
|
// Get rid of the hiding notifications
|
|
gNotificationBox.removeAllNotifications(true);
|
|
test5();
|
|
}
|
|
|
|
// Tests that removeAllNotifications gets rid of everything
|
|
function test5() {
|
|
let notification = gNotificationBox.appendNotification("Test notification",
|
|
"notification7", null,
|
|
gNotificationBox.PRIORITY_INFO_LOW,
|
|
null);
|
|
let notification2 = gNotificationBox.appendNotification("Test notification",
|
|
"notification8", null,
|
|
gNotificationBox.PRIORITY_INFO_LOW,
|
|
null);
|
|
gNotificationBox.removeAllNotifications();
|
|
notification = gNotificationBox.getNotificationWithValue("notification7");
|
|
notification2 = gNotificationBox.getNotificationWithValue("notification8");
|
|
ok(!notification, "Test 5 showed notification was still present");
|
|
ok(!notification2, "Test 5 showed notification2 was still present");
|
|
ok(!gNotificationBox.currentNotification, "Test 5 said there was still a current notification");
|
|
is(gNotificationBox.allNotifications.length, 0, "Test 5 should show 0 notifications present");
|
|
|
|
gNotificationBox.appendNotification("Test notification",
|
|
"notification9", null,
|
|
gNotificationBox.PRIORITY_INFO_LOW,
|
|
null);
|
|
|
|
// Wait for the notificaton to finish displaying
|
|
completeAnimation(test6);
|
|
}
|
|
|
|
// Tests whether removing an already removed notification doesn't break things
|
|
function test6() {
|
|
let notification = gNotificationBox.getNotificationWithValue("notification9");
|
|
ok(notification, "Test 6 should have an initial notification");
|
|
gNotificationBox.removeNotification(notification);
|
|
gNotificationBox.removeNotification(notification);
|
|
|
|
ok(!gNotificationBox.currentNotification, "Test 6 shouldn't be any current notification");
|
|
is(gNotificationBox.allNotifications.length, 0, "Test 6 allNotifications.length should be 0");
|
|
notification = gNotificationBox.appendNotification("Test notification",
|
|
"notification10", null,
|
|
gNotificationBox.PRIORITY_INFO_LOW,
|
|
null);
|
|
is(notification, gNotificationBox.currentNotification, "Test 6 should have made the current notification");
|
|
gNotificationBox.removeNotification(notification);
|
|
|
|
SimpleTest.finish();
|
|
}
|
|
]]>
|
|
</script>
|
|
|
|
</window>
|