Bug 651474 - Random Orange TEST-UNEXPECTED-FAIL | (runtestlist.py) | Exited with code 1 during test_buttons_collapse_and_expand in quick-filter-bar tests. rs=simple-orange-fix try-push was http://hg.mozilla.org/try-comm-central/rev/37ca9c8a7aca
--- a/mail/test/mozmill/quick-filter-bar/test-display-issues.js
+++ b/mail/test/mozmill/quick-filter-bar/test-display-issues.js
@@ -55,26 +55,28 @@ function setupModule(module) {
wh.installInto(module);
let qfb = collector.getModule('quick-filter-bar-helper');
qfb.installInto(module);
folder = create_folder("QuickFilterBarDisplayIssues");
be_in_folder(folder);
}
+function wait_for_resize(width) {
+ mc.waitForEval("subject.outerWidth == " + width, 1000, 50, mc.window);
+}
+
function resize_to(width, height) {
mark_action("test", "resize_to", [width, "x", height]);
mc.window.resizeTo(width, height);
// Give the event loop a spin in order to let the reality of an asynchronously
// interacting window manager have its impact. This still may not be
// sufficient.
mc.sleep(0);
- mc.waitForEval("subject.outerWidth == " + width + " && " +
- " subject.outerHeight == " + height,
- 1000, 50, mc.window);
+ wait_for_resize(width);
}
function collapse_folder_pane(shouldBeCollapsed) {
mark_action("test", "collapse_folder_pane",
[shouldBeCollapsed]);
mc.e("folderpane_splitter").setAttribute("state",
shouldBeCollapsed ? "collapsed"
: "open");
@@ -100,25 +102,33 @@ function test_buttons_collapse_and_expan
mark_action("test", "log_window_state",
[aWhen,
"location:", mc.window.screenX, mc.window.screenY,
"dims:", mc.window.outerWidth, mc.window.outerHeight,
"Collapsy bar width:", qfbCollapsy.clientWidth,
"shrunk?", qfbCollapsy.getAttribute("shrink")]);
}
- function assertCollapsed() {
+ function assertCollapsed(width) {
+ // It's possible the window hasn't actually resized yet, so double-check and
+ // spin if needed.
+ wait_for_resize(width);
+
// The bar should be shrunken and the button should be the same size as its
// image!
if (qfbCollapsy.getAttribute("shrink") != "true")
throw new Error("The collapsy bar should be shrunk!");
if (qfbExemplarLabel.clientWidth != 0)
throw new Error("The exemplar label should be collapsed!");
}
- function assertExpanded() {
+ function assertExpanded(width) {
+ // It's possible the window hasn't actually resized yet, so double-check and
+ // spin if needed.
+ wait_for_resize(width);
+
// The bar should not be shrunken and the button should be smaller than its
// label!
if (qfbCollapsy.hasAttribute("shrink"))
throw new Error("The collapsy bar should not be shrunk!");
if (qfbExemplarLabel.clientWidth == 0)
throw new Error("The exemplar label should not be collapsed!");
}
@@ -127,33 +137,33 @@ function test_buttons_collapse_and_expan
// -- GIANT!
resize_to(1200, 600);
// Right, so resizeTo caps us at the display size limit, so we may end up
// smaller than we want. So let's turn off the folder pane too.
collapse_folder_pane(true);
// spin the event loop once
mc.sleep(0);
logState("giant");
- assertExpanded();
+ assertExpanded(1200);
// -- tiny.
collapse_folder_pane(false);
resize_to(600, 600);
// spin the event loop once
mc.sleep(0);
logState("tiny");
- assertCollapsed();
+ assertCollapsed(600);
// -- GIANT again!
resize_to(1200, 600);
collapse_folder_pane(true);
// spin the event loop once
mc.sleep(0);
logState("giant again!");
- assertExpanded();
+ assertExpanded(1200);
}
function teardownModule() {
// restore window to nominal dimensions; saving was not working out
// See also: message-header/test-message-header.js if we change the
// default window size.
resize_to(1024, 768);
collapse_folder_pane(false);