This commit is contained in:
Dão Gottwald 2009-03-12 14:45:00 +01:00
commit bee0276a4e
2 changed files with 0 additions and 57 deletions

View File

@ -99,7 +99,6 @@ _BROWSER_FILES = browser_sanitize-timespans.js \
browser_sanitize-passwordDisabledHosts.js \
browser_bug479408.js \
browser_bug479408_sample.html \
browser_overflowScroll.js \
$(NULL)
ifeq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))

View File

@ -1,56 +0,0 @@
const tabContainer = gBrowser.tabContainer;
const tabStrip = tabContainer.mTabstrip;
function runOverflowTests(aEvent) {
if (aEvent.detail != 1)
return;
tabStrip.removeEventListener("overflow", runOverflowTests, false);
var firstTab = tabContainer.firstChild;
var lastTab = tabContainer.lastChild;
var upButton = tabStrip._scrollButtonUp;
var upButtonRect = upButton.getBoundingClientRect();
var downButton = tabStrip._scrollButtonDown;
var downButtonRect = downButton.getBoundingClientRect();
tabStrip.ensureElementIsVisible(firstTab);
var rect = firstTab.getBoundingClientRect();
is(rect.left, upButtonRect.right, "Tab should scroll into view");
tabStrip.scrollByIndex(1);
rect = lastTab.getBoundingClientRect();
is(rect.right, downButtonRect.left, "Tab should scroll into view");
var element = tabStrip._elementFromPoint(upButtonRect.right);
if (element.getBoundingClientRect().left == upButtonRect.right)
element = element.previousSibling;
EventUtils.synthesizeMouse(upButton, 0, 0, {clickCount: 1});
rect = element.getBoundingClientRect();
is(rect.left, upButtonRect.right, "One tab should have been scrolled");
EventUtils.synthesizeMouse(upButton, 0, 0, {clickCount: 2});
EventUtils.synthesizeMouse(upButton, 0, 0, {clickCount: 3, detail: 3, originalTarget: upButton});
rect = firstTab.getBoundingClientRect();
is(rect.left, upButtonRect.right, "Tabs should scroll to start");
element = tabStrip._elementFromPoint(rect.left);
ok(element == firstTab, "_elementFromPoint should recognize the tabs");
while (tabContainer.childNodes.length > 1)
gBrowser.removeTab(tabContainer.lastChild);
finish();
}
function test() {
waitForExplicitFinish();
tabStrip.smoothScroll = false;
let tabMinWidth = Components.classes['@mozilla.org/preferences-service;1']
.getService(Components.interfaces.nsIPrefBranch2)
.getIntPref("browser.tabs.tabMinWidth");
var tabCountForOverflow =
Math.floor(tabStrip.getBoundingClientRect().width / tabMinWidth);
while (tabContainer.childNodes.length < tabCountForOverflow)
gBrowser.addTab();
gBrowser.addTab();
gBrowser.selectedTab = tabContainer.lastChild.previousSibling;
tabStrip.addEventListener("overflow", runOverflowTests, false);
}