Test for bug 632379, r=ehsan, a=test
authorSimon Montagu <smontagu@smontagu.org>
Sun, 13 Feb 2011 23:56:24 -0800
changeset 62501 26421a3b68f3d33e8496c29ecc0de9a9ba523a87
parent 62500 385abb827ff331157305e44c2792e2a3d632e2df
child 62502 7fa4835d58bd4f2a626be548c846663cf4d520cc
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, test
bugs632379
milestone2.0b12pre
first release with
nightly linux32
26421a3b68f3 / 4.0b12pre / 20110214030347 / files
nightly linux64
26421a3b68f3 / 4.0b12pre / 20110214030347 / files
nightly mac
26421a3b68f3 / 4.0b12pre / 20110214030347 / files
nightly win32
26421a3b68f3 / 4.0b12pre / 20110214030347 / files
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
Test for bug 632379, r=ehsan, a=test
layout/generic/test/Makefile.in
layout/generic/test/test_bug632379.xul
--- a/layout/generic/test/Makefile.in
+++ b/layout/generic/test/Makefile.in
@@ -119,16 +119,17 @@ include $(topsrcdir)/config/rules.mk
 		file_LoadingImageReference.png \
 		file_bug514732_1.html \
 		file_bug514732_helper.html \
 		file_bug579767_1.html \
 		file_bug579767_2.html \
 		test_bug522632.html \
 		test_bug589621.html \
 		test_bug589623.html \
+		test_bug632379.xul \
 		$(srcdir)/../../reftests/backgrounds/blue-32x32.png \
 		$(srcdir)/../../reftests/backgrounds/fuchsia-32x32.png \
 		$(NULL)
 
 _CHROME_FILES = \
 		test_bug514732-2.xul \
 		file_bug514732_window.xul \
 		$(NULL)
new file mode 100644
--- /dev/null
+++ b/layout/generic/test/test_bug632379.xul
@@ -0,0 +1,206 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=632379
+-->
+<window title="Mozilla Bug 632379"
+  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+  <title>Test for Bug 632379</title>
+  <script type="application/javascript" src="/MochiKit/packed.js" />
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"/>
+  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+
+<toolbox flex="1">
+  <menubar>
+    <menu label="MENU" accesskey="m" id="mainMenu">
+      <menupopup maxheight="100" onpopupshown="openSubmenu()">
+        <menu label="menu1" accesskey="1" id="menu1">
+          <menupopup onpopupshown="snapshot(this)">
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+          </menupopup>
+        </menu>
+        <menu label="menu2" accesskey="2" id="menu2">
+          <menupopup onpopupshown="snapshot(this)">
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+          </menupopup>
+        </menu>
+        <menu label="menu3" accesskey="3" id="menu3">
+          <menupopup onpopupshown="snapshot(this)">
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+          </menupopup>
+        </menu>
+        <menu label="menu4" accesskey="4" id="menu4">
+          <menupopup onpopupshown="snapshot(this)">
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+          </menupopup>
+        </menu>
+        <menu label="menu5" accesskey="5" id="menu5">
+	  <menupopup onpopupshown="snapshot(this)">
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+          </menupopup>
+        </menu>
+        <menu label="menu6" accesskey="6" id="menu6">
+          <menupopup onpopupshown="snapshot(this)">
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+          </menupopup>
+        </menu>
+        <menu label="menu7" accesskey="7" id="menu7">
+          <menupopup onpopupshown="snapshot(this)">
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+          </menupopup>
+        </menu>
+        <menu label="menu8" accesskey="8" id="menu8">
+          <menupopup onpopupshown="snapshot(this)">
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+          </menupopup>
+        </menu>
+        <menu label="menu9" accesskey="9" id="menu9">
+          <menupopup onpopupshown="snapshot(this)">
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+            <menuitem label="item"/>
+          </menupopup>
+        </menu>
+      </menupopup>
+    </menu>
+  </menubar>
+</toolbox>
+
+<body  xmlns="http://www.w3.org/1999/xhtml">
+  <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=632379">Mozilla Bug 632379</a>
+
+  <p id="display"></p>
+<div id="content" style="display: none">
+</div>
+</body>
+
+
+<script class="testbody" type="application/javascript"><![CDATA[
+
+/** Test for Bug 632379 **/
+// Tests whether scrolling a menu affects the position at which popups appear
+var pos = new Array(2);
+var count=0;
+
+function snapshot(elem)
+{
+    pos[count] = elem.getBoundingClientRect().top;
+    ++count;
+    if (count <= 1) {
+	// close the submenu and open the bottom submenu
+	synthesizeKey("VK_LEFT", {});
+	synthesizeKey("9", {});
+    } else {
+	is(pos[1], pos[0], "Popup should open in the same place when the menu is scrolled");
+
+	SimpleTest.finish();
+    }
+}
+
+function doTest() {
+    // open the top-level menu
+    $("mainMenu").open = true;
+}
+
+function openSubmenu()
+{
+    // open a submenu in the middle
+    synthesizeKey("5", {});
+}
+
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(doTest);
+
+]]></script>
+</window>
+