michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: function test() { michael@0: let cw; michael@0: let win; michael@0: michael@0: waitForExplicitFinish(); michael@0: michael@0: newWindowWithTabView(function (tvwin) { michael@0: win = tvwin; michael@0: cw = win.TabView.getContentWindow(); michael@0: michael@0: registerCleanupFunction(function () { michael@0: if (win && !win.closed) michael@0: win.close(); michael@0: }); michael@0: michael@0: // fill the group item with some tabs michael@0: for (let i = 0; i < 5; i++) michael@0: win.gBrowser.loadOneTab("about:blank"); michael@0: michael@0: let groupItem = cw.GroupItems.groupItems[0]; michael@0: groupItem.setSize(400, 400, true); michael@0: let range = new cw.Range(1, 400); michael@0: michael@0: // determine the groupItem's largest possible stacked size michael@0: while (range.extent > 1) { michael@0: let pivot = Math.floor(range.extent / 2); michael@0: groupItem.setSize(range.min + pivot, range.min + pivot, true); michael@0: michael@0: if (groupItem.isStacked()) michael@0: range.min += pivot; michael@0: else michael@0: range.max -= pivot; michael@0: } michael@0: michael@0: // stack the group michael@0: groupItem.setSize(range.min, range.min, true); michael@0: ok(groupItem.isStacked(), "groupItem is stacked"); michael@0: michael@0: // one step back to un-stack the groupItem michael@0: groupItem.setSize(range.max, range.max, true); michael@0: ok(!groupItem.isStacked(), "groupItem is no longer stacked"); michael@0: michael@0: // check that close buttons are visible michael@0: let tabItem = groupItem.getChild(0); michael@0: isnot(tabItem.$close.css("display"), "none", "close button is visible"); michael@0: michael@0: finish(); michael@0: }); michael@0: }