summaryrefslogtreecommitdiffstats
path: root/widget/tests/test_clipboard_cache.xhtml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /widget/tests/test_clipboard_cache.xhtml
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'widget/tests/test_clipboard_cache.xhtml')
-rw-r--r--widget/tests/test_clipboard_cache.xhtml56
1 files changed, 56 insertions, 0 deletions
diff --git a/widget/tests/test_clipboard_cache.xhtml b/widget/tests/test_clipboard_cache.xhtml
new file mode 100644
index 0000000000..39cf8113dd
--- /dev/null
+++ b/widget/tests/test_clipboard_cache.xhtml
@@ -0,0 +1,56 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1812543
+-->
+<window title="Mozilla Bug 1812543"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+<script type="application/javascript" src="clipboard_helper.js"/>
+
+<!-- test results are displayed in the html:body -->
+<body xmlns="http://www.w3.org/1999/xhtml">
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+</body>
+
+<!-- test code goes here -->
+<script class="testbody" type="application/javascript">
+<![CDATA[
+
+let supportOtherClipboardTypes = false;
+clipboardTypes.forEach(function(type) {
+ if (clipboard.kGlobalClipboard != type && clipboard.isClipboardTypeSupported(type)) {
+ supportOtherClipboardTypes = true;
+ add_task(function test_clipboard_hasDataMatchingFlavors() {
+ info(`Test write data to clipboard type ${type}`);
+
+ // Write text/plain data to main clipboard.
+ writeRandomStringToClipboard("text/plain", clipboard.kGlobalClipboard);
+ ok(clipboard.hasDataMatchingFlavors(["text/plain"], clipboard.kGlobalClipboard),
+ "Should have text/plain flavor");
+ ok(!clipboard.hasDataMatchingFlavors(["text/html"], clipboard.kGlobalClipboard),
+ "Should not have text/html flavor");
+
+ // Write text/html data to other clipboard.
+ writeRandomStringToClipboard("text/html", type);
+ ok(clipboard.hasDataMatchingFlavors(["text/plain"], clipboard.kGlobalClipboard),
+ "Should have text/plain flavor");
+ ok(!clipboard.hasDataMatchingFlavors(["text/html"], clipboard.kGlobalClipboard),
+ "Should not have text/html flavor");
+
+ // Clean clipboard data.
+ cleanupAllClipboard();
+ });
+ }
+});
+
+if (!supportOtherClipboardTypes) {
+ ok(true, "Don't support other clipboard types, skip tests");
+}
+
+]]>
+</script>
+</window>