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