зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1271119 - Port test_bug1140617.xul from chrome to plain; r=masayuki
Possible issue: the previous version saved document.popupNode and restored it after copying the image, and the new version does not (because I don't know how). The test seems to pass anyway. MozReview-Commit-ID: 7g0JCYxI7x8 --HG-- rename : editor/libeditor/tests/test_bug1140617.xul => editor/libeditor/tests/test_bug1140617.html
This commit is contained in:
Родитель
1b70f4e9fb
Коммит
953f75ec49
|
@ -12,8 +12,6 @@ skip-if = buildapp == 'mulet'
|
|||
[test_bug636465.xul]
|
||||
[test_bug780908.xul]
|
||||
[test_bug1102906.html]
|
||||
[test_bug1140617.xul]
|
||||
subsuite = clipboard
|
||||
[test_bug1153237.html]
|
||||
[test_bug1248128.html]
|
||||
[test_bug1248185.html]
|
||||
|
|
|
@ -184,6 +184,9 @@ skip-if = os == 'android'
|
|||
subsuite = clipboard
|
||||
[test_bug1109465.html]
|
||||
[test_bug1140105.html]
|
||||
[test_bug1140617.html]
|
||||
subsuite = clipboard
|
||||
skip-if = toolkit == 'android' # bug 1299578
|
||||
[test_bug1154791.html]
|
||||
skip-if = os == 'android'
|
||||
[test_bug1162952.html]
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
<!doctype html>
|
||||
<title>Mozilla Bug 1140617</title>
|
||||
<link rel=stylesheet href="/tests/SimpleTest/test.css">
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1140617"
|
||||
target="_blank">Mozilla Bug 1140617</a>
|
||||
<iframe id="i1" width="200" height="100" src="about:blank"></iframe>
|
||||
<img id="i" src="green.png">
|
||||
<script>
|
||||
function runTest() {
|
||||
SpecialPowers.setCommandNode(window, document.getElementById("i"));
|
||||
SpecialPowers.doCommand(window, "cmd_copyImageContents");
|
||||
|
||||
var e = document.getElementById('i1');
|
||||
var doc = e.contentDocument;
|
||||
doc.designMode = "on";
|
||||
doc.defaultView.focus();
|
||||
var selection = doc.defaultView.getSelection();
|
||||
selection.removeAllRanges();
|
||||
selection.selectAllChildren(doc.body);
|
||||
selection.collapseToEnd();
|
||||
|
||||
doc.execCommand("fontname", false, "Arial");
|
||||
doc.execCommand("bold", false, null);
|
||||
doc.execCommand("insertText", false, "12345");
|
||||
doc.execCommand("paste", false, null);
|
||||
doc.execCommand("insertText", false, "a");
|
||||
|
||||
is(doc.queryCommandValue("fontname"), "Arial", "Arial expected");
|
||||
is(doc.queryCommandState("bold"), true, "Bold expected");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(runTest);
|
||||
</script>
|
|
@ -1,70 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin"
|
||||
type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
||||
type="text/css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1140617
|
||||
-->
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="Mozilla Bug 1140617" onload="runTest();">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1140617"
|
||||
target="_blank">Mozilla Bug 1140617</a>
|
||||
<p/>
|
||||
<iframe id="i1" width="200" height="100" src="about:blank" /><br />
|
||||
<img id="i" src="green.png" />
|
||||
<p/>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
<script class="testbody" type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
function runTest() {
|
||||
function pasteIntoAndCheck() {
|
||||
var e = document.getElementById('i1');
|
||||
var doc = e.contentDocument;
|
||||
doc.designMode = "on";
|
||||
doc.defaultView.focus();
|
||||
var selection = doc.defaultView.getSelection();
|
||||
selection.removeAllRanges();
|
||||
selection.selectAllChildren(doc.body);
|
||||
selection.collapseToEnd();
|
||||
|
||||
doc.execCommand("fontname", false, "Arial");
|
||||
doc.execCommand("bold", false, null);
|
||||
doc.execCommand("insertText", false, "12345");
|
||||
doc.execCommand("paste", false, null);
|
||||
doc.execCommand("insertText", false, "a");
|
||||
|
||||
is(doc.queryCommandValue("fontname"), "Arial", "Arial expected");
|
||||
is(doc.queryCommandState("bold"), true, "Bold expected");
|
||||
}
|
||||
|
||||
function copyToClipBoard() {
|
||||
var tmpNode = document.popupNode;
|
||||
document.popupNode = document.getElementById("i");
|
||||
|
||||
const kCmd = "cmd_copyImageContents";
|
||||
var controller = top.document.commandDispatcher
|
||||
.getControllerForCommand(kCmd);
|
||||
ok((controller && controller.isCommandEnabled(kCmd)), "have copy command");
|
||||
controller.doCommand(kCmd);
|
||||
|
||||
document.popupNode = tmpNode;
|
||||
}
|
||||
|
||||
copyToClipBoard();
|
||||
pasteIntoAndCheck();
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
]]>
|
||||
</script>
|
||||
</window>
|
Загрузка…
Ссылка в новой задаче