Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | function test() { |
michael@0 | 5 | let cw; |
michael@0 | 6 | let win; |
michael@0 | 7 | |
michael@0 | 8 | waitForExplicitFinish(); |
michael@0 | 9 | |
michael@0 | 10 | newWindowWithTabView(function (tvwin) { |
michael@0 | 11 | win = tvwin; |
michael@0 | 12 | cw = win.TabView.getContentWindow(); |
michael@0 | 13 | |
michael@0 | 14 | registerCleanupFunction(function () { |
michael@0 | 15 | if (win && !win.closed) |
michael@0 | 16 | win.close(); |
michael@0 | 17 | }); |
michael@0 | 18 | |
michael@0 | 19 | // fill the group item with some tabs |
michael@0 | 20 | for (let i = 0; i < 5; i++) |
michael@0 | 21 | win.gBrowser.loadOneTab("about:blank"); |
michael@0 | 22 | |
michael@0 | 23 | let groupItem = cw.GroupItems.groupItems[0]; |
michael@0 | 24 | groupItem.setSize(400, 400, true); |
michael@0 | 25 | let range = new cw.Range(1, 400); |
michael@0 | 26 | |
michael@0 | 27 | // determine the groupItem's largest possible stacked size |
michael@0 | 28 | while (range.extent > 1) { |
michael@0 | 29 | let pivot = Math.floor(range.extent / 2); |
michael@0 | 30 | groupItem.setSize(range.min + pivot, range.min + pivot, true); |
michael@0 | 31 | |
michael@0 | 32 | if (groupItem.isStacked()) |
michael@0 | 33 | range.min += pivot; |
michael@0 | 34 | else |
michael@0 | 35 | range.max -= pivot; |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | // stack the group |
michael@0 | 39 | groupItem.setSize(range.min, range.min, true); |
michael@0 | 40 | ok(groupItem.isStacked(), "groupItem is stacked"); |
michael@0 | 41 | |
michael@0 | 42 | // one step back to un-stack the groupItem |
michael@0 | 43 | groupItem.setSize(range.max, range.max, true); |
michael@0 | 44 | ok(!groupItem.isStacked(), "groupItem is no longer stacked"); |
michael@0 | 45 | |
michael@0 | 46 | // check that close buttons are visible |
michael@0 | 47 | let tabItem = groupItem.getChild(0); |
michael@0 | 48 | isnot(tabItem.$close.css("display"), "none", "close button is visible"); |
michael@0 | 49 | |
michael@0 | 50 | finish(); |
michael@0 | 51 | }); |
michael@0 | 52 | } |