diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /devtools/shared/qrcode/tests/xpcshell/test_encode.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream/115.8.0esr.tar.xz firefox-esr-upstream/115.8.0esr.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/shared/qrcode/tests/xpcshell/test_encode.js')
-rw-r--r-- | devtools/shared/qrcode/tests/xpcshell/test_encode.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/devtools/shared/qrcode/tests/xpcshell/test_encode.js b/devtools/shared/qrcode/tests/xpcshell/test_encode.js new file mode 100644 index 0000000000..7c82cf50c0 --- /dev/null +++ b/devtools/shared/qrcode/tests/xpcshell/test_encode.js @@ -0,0 +1,30 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + +/** + * Test encoding a simple message. + */ + +const { require } = ChromeUtils.importESModule( + "resource://devtools/shared/loader/Loader.sys.mjs" +); + +const QR = require("resource://devtools/shared/qrcode/index.js"); + +function run_test() { + const imgData = QR.encodeToDataURI("HELLO", "L"); + Assert.equal( + imgData.src, + "data:image/gif;base64,R0lGODdhOgA6AIAAAAAAAP///ywAAAAAOgA6AAAC" + + "/4yPqcvtD6OctNqLs968+w+G4gKU5nkaKKquLuW+QVy2tAkDTj3rfQts8CRDko" + + "+HPPoYRUgy9YsyldDm44mLWhHYZM6W7WaDqyCRGkZDySxpRGw2sqvLt1q5w/fo" + + "XyE6vnUQOJUHBlinMGh046V1F5PDqNcoqcgBOWKBKbK2N+aY+Ih49VkmqMcl2l" + + "dkhZUK1umE6jZXJ2ZJaujZaRqH4bpb2uZrJxvIt4Ebe9qoYYrJOsw8apz2bCut" + + "m9kqDcw52uuImyr5Oh1KXH1jrn2anuunywtODU/o2c6teceW39ZcLFg/fNMo1b" + + "t3jVw2dwTPwJq1KYG3gAklCgu37yGxeScYKyiCc+7DR34hPVQiuQ7UhJMagyEb" + + "lymmzJk0a9q8iTOnzp0NCgAAOw==" + ); + Assert.equal(imgData.width, 58); + Assert.equal(imgData.height, 58); +} |