mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 608266 - [Regression] Can't open a link in new tab from the awesome panels - tests [r=vingtetun]
This commit is contained in:
parent
ad3fe26ec5
commit
6d43748463
@ -248,5 +248,70 @@ gTests.push({
|
||||
BrowserUI.activePanel = null;
|
||||
runNextTest();
|
||||
}
|
||||
}); //------------------------------------------------------------------------------
|
||||
// Case: Test opening the awesome panel and checking the urlbar selection
|
||||
gTests.push({
|
||||
desc: "Test context clicks on awesome panel",
|
||||
|
||||
_panelIndex : 0,
|
||||
_contextOpts : [
|
||||
["link-openable", "link-shareable"],
|
||||
["link-openable", "link-shareable"],
|
||||
["edit-bookmark", "link-shareable", "link-openable"],
|
||||
],
|
||||
|
||||
clearContextTypes: function clearContextTypes() {
|
||||
if (ContextHelper.popupState)
|
||||
ContextHelper.hide();
|
||||
},
|
||||
|
||||
checkContextTypes: function checkContextTypes(aTypes) {
|
||||
let commandlist = document.getElementById("context-commands");
|
||||
|
||||
for (let i=0; i<commandlist.childNodes.length; i++) {
|
||||
let command = commandlist.childNodes[i];
|
||||
if (aTypes.indexOf(command.getAttribute("type")) > -1) {
|
||||
// command should be visible
|
||||
if(command.hidden == true)
|
||||
return false;
|
||||
} else {
|
||||
if(command.hidden == false)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
run: function() {
|
||||
window.addEventListener("NavigationPanelShown", function(aEvent) {
|
||||
window.removeEventListener(aEvent.type, arguments.callee, false);
|
||||
gCurrentTest.onPopupReady();
|
||||
}, false);
|
||||
|
||||
AllPagesList.doCommand();
|
||||
},
|
||||
|
||||
onPopupReady: function() {
|
||||
let self = this;
|
||||
if(self._panelIndex < Panels.length) {
|
||||
let panel = Panels[self._panelIndex];
|
||||
panel.doCommand();
|
||||
|
||||
self.clearContextTypes();
|
||||
|
||||
EventUtils.synthesizeMouse(panel.panel, panel.panel.width / 2, panel.panel.height / 2, { type: "mousedown" });
|
||||
setTimeout(function() {
|
||||
EventUtils.synthesizeMouse(panel.panel, panel.panel.width / 2, panel.panel.height / 2, { type: "mouseup" });
|
||||
ok(self.checkContextTypes(self._contextOpts[self._panelIndex]), "Correct context menu shown for panel");
|
||||
self.clearContextTypes();
|
||||
|
||||
self._panelIndex++;
|
||||
self.onPopupReady();
|
||||
}, 500);
|
||||
} else {
|
||||
runNextTest();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
@ -20,14 +20,14 @@ function clearEvents() {
|
||||
|
||||
function checkEvents(aEvents) {
|
||||
if (aEvents.length != gEvents.length) {
|
||||
dump("---- event check: failed length (" + aEvents.length + " != " + gEvents.length + ")\n");
|
||||
dump("---- expected: [" + aEvents.join(",") + "] actual: [" + gEvents.join(",") + "]\n");
|
||||
info("---- event check: failed length (" + aEvents.length + " != " + gEvents.length + ")\n");
|
||||
info("---- expected: [" + aEvents.join(",") + "] actual: [" + gEvents.join(",") + "]\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (let i=0; i<aEvents.length; i++) {
|
||||
if (aEvents[i] != gEvents[i]) {
|
||||
dump("---- event check: failed match (" + aEvents[i] + " != " + gEvents[i] + "\n");
|
||||
info("---- event check: failed match (" + aEvents[i] + " != " + gEvents[i] + "\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -52,15 +52,15 @@ function clearContextTypes() {
|
||||
|
||||
function checkContextTypes(aTypes) {
|
||||
if (aTypes.length != gContextTypes.length) {
|
||||
dump("---- type check: failed length (" + aTypes.length + " != " + gContextTypes.length + ")\n");
|
||||
dump("---- expected: [" + aTypes.join(",") + "] actual: [" + gContextTypes.join(",") + "]\n");
|
||||
info("---- type check: failed length (" + aTypes.length + " != " + gContextTypes.length + ")\n");
|
||||
info("---- expected: [" + aTypes.join(",") + "] actual: [" + gContextTypes.join(",") + "]\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (let i=0; i<aTypes.length; i++) {
|
||||
if (gContextTypes.indexOf(aTypes[i]) == -1) {
|
||||
dump("---- type check: failed match (" + aTypes[i] + ")\n");
|
||||
dump("---- expected: [" + aTypes.join(",") + "] actual: [" + gContextTypes.join(",") + "]\n");
|
||||
info("---- type check: failed match (" + aTypes[i] + ")\n");
|
||||
info("---- expected: [" + aTypes.join(",") + "] actual: [" + gContextTypes.join(",") + "]\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -218,14 +218,13 @@ gTests.push({
|
||||
browser.messageManager.addMessageListener("Browser:ContextMenu", dumpMessages);
|
||||
|
||||
let link = browser.contentDocument.getElementById("link-single");
|
||||
let bcr = link.getBoundingClientRect();
|
||||
let linkRect = link.getBoundingClientRect();
|
||||
|
||||
clearContextTypes();
|
||||
EventUtils.synthesizeMouseForContent(link, bcr.width/2, bcr.height/2, { type: "mousedown" }, window);
|
||||
EventUtils.synthesizeMouseForContent(link, linkRect.width/2, linkRect.height/4, { type: "mousedown" }, window);
|
||||
setTimeout(function() {
|
||||
EventUtils.synthesizeMouseForContent(link, bcr.width/2, bcr.height/2, { type: "mouseup" }, window);
|
||||
ok(checkContextTypes(["link","link-saveable"]), "Plain link context types");
|
||||
EventUtils.synthesizeMouseForContent(link, linkRect.width/2, linkRect.height/4, { type: "mouseup" }, window);
|
||||
ok(checkContextTypes(["link","link-saveable","link-openable"]), "Plain link context types");
|
||||
clearContextTypes();
|
||||
|
||||
gCurrentTest.contextPlainImageTest();
|
||||
@ -240,7 +239,7 @@ gTests.push({
|
||||
let imgRect = img.getBoundingClientRect();
|
||||
|
||||
clearContextTypes();
|
||||
EventUtils.synthesizeMouseForContent(img, 1, 1, { type: "mousedown" }, window);
|
||||
EventUtils.synthesizeMouseForContent(img, imgRect.width/2, imgRect.height/2, { type: "mousedown" }, window);
|
||||
setTimeout(function() {
|
||||
EventUtils.synthesizeMouseForContent(img, 1, 1, { type: "mouseup" }, window);
|
||||
ok(checkContextTypes(["image","image-shareable","image-loaded"]), "Plain image context types");
|
||||
@ -261,7 +260,7 @@ gTests.push({
|
||||
EventUtils.synthesizeMouseForContent(img, 1, 1, { type: "mousedown" }, window);
|
||||
setTimeout(function() {
|
||||
EventUtils.synthesizeMouseForContent(img, 1, 1, { type: "mouseup" }, window);
|
||||
ok(checkContextTypes(["link","link-saveable","image","image-shareable","image-loaded"]), "Nested image context types");
|
||||
ok(checkContextTypes(["link","link-saveable","image","image-shareable","image-loaded","link-openable"]), "Nested image context types");
|
||||
clearContextTypes();
|
||||
|
||||
gCurrentTest.lastTest();
|
||||
|
Loading…
Reference in New Issue
Block a user