From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../tests/unit/test_hunspell_unicode_paths.js | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 extensions/spellcheck/hunspell/tests/unit/test_hunspell_unicode_paths.js (limited to 'extensions/spellcheck/hunspell/tests/unit/test_hunspell_unicode_paths.js') diff --git a/extensions/spellcheck/hunspell/tests/unit/test_hunspell_unicode_paths.js b/extensions/spellcheck/hunspell/tests/unit/test_hunspell_unicode_paths.js new file mode 100644 index 0000000000..3fb4c78b59 --- /dev/null +++ b/extensions/spellcheck/hunspell/tests/unit/test_hunspell_unicode_paths.js @@ -0,0 +1,42 @@ +"use strict"; + +const { XPCOMUtils } = ChromeUtils.importESModule( + "resource://gre/modules/XPCOMUtils.sys.mjs" +); + +XPCOMUtils.defineLazyServiceGetter( + this, + "spellCheck", + "@mozilla.org/spellchecker/engine;1", + "mozISpellCheckingEngine" +); + +const nsFile = Components.Constructor( + "@mozilla.org/file/local;1", + "nsIFile", + "initWithPath" +); + +add_task(async function () { + let prof = do_get_profile(); + + let basePath = PathUtils.join(prof.path, "\u263a", "dictionaries"); + let baseDir = nsFile(basePath); + await IOUtils.makeDirectory(basePath, { createAncestors: true }); + + let dicPath = PathUtils.join(basePath, "dict.dic"); + let affPath = PathUtils.join(basePath, "dict.aff"); + + const WORD = "Flehgragh"; + + await IOUtils.writeUTF8(dicPath, `1\n${WORD}\n`); + await IOUtils.writeUTF8(affPath, ""); + + spellCheck.loadDictionariesFromDir(baseDir); + spellCheck.dictionaries = ["dict"]; + + ok( + spellCheck.check(WORD), + "Dictionary should have been loaded from a unicode path" + ); +}); -- cgit v1.2.3