browser/components/tabview/test/browser_tabview_bug673196.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/tabview/test/browser_tabview_bug673196.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,36 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +function test() {
     1.8 +  function onLoad(win) {
     1.9 +    registerCleanupFunction(function () win.close());
    1.10 +    win.gBrowser.addTab();
    1.11 +  }
    1.12 +
    1.13 +  function onShow(win) {
    1.14 +    let cw = win.TabView.getContentWindow();
    1.15 +    let group = cw.GroupItems.groupItems[0];
    1.16 +
    1.17 +    // shrink the group to make some room for dragging
    1.18 +    group.setSize(200, 200, true);
    1.19 +
    1.20 +    waitForFocus(function () {
    1.21 +      let target = group.getChild(0).container;
    1.22 +      EventUtils.synthesizeMouseAtCenter(target, {type: "mousedown"}, cw);
    1.23 +      EventUtils.synthesizeMouse(target, 0, 300, {type: "mousemove"}, cw);
    1.24 +      EventUtils.synthesizeMouseAtCenter(target, {type: "mouseup"}, cw);
    1.25 +
    1.26 +      let newGroup = cw.GroupItems.groupItems[1];
    1.27 +      let groupBounds = newGroup.getBounds();
    1.28 +
    1.29 +      let safeWindowBounds = cw.Items.getSafeWindowBounds();
    1.30 +      ok(safeWindowBounds.contains(groupBounds),
    1.31 +         "new group is within safe window bounds");
    1.32 +
    1.33 +      finish();
    1.34 +    }, cw);
    1.35 +  }
    1.36 +
    1.37 +  waitForExplicitFinish();
    1.38 +  newWindowWithTabView(onShow, onLoad);
    1.39 +}

mercurial