Bug 1204540 - Fix up spell checker tests so no content preferences are left behind. r=roc

--HG--
rename : editor/composer/test/test_abug697981.html => editor/composer/test/test_bug697981.html
This commit is contained in:
Jorg K 2015-09-15 10:34:00 +02:00
Родитель 62c77a53c5
Коммит d5c55e50cc
7 изменённых файлов: 15 добавлений и 14 удалений

Просмотреть файл

@ -600,8 +600,9 @@ nsEditorSpellCheck::SetCurrentDictionary(const nsAString& aDictionary)
uint32_t flags = 0;
mEditor->GetFlags(&flags);
if (!(flags & nsIPlaintextEditor::eEditorMailMask)) {
if (mPreferredLang.IsEmpty() ||
!mPreferredLang.Equals(aDictionary, nsCaseInsensitiveStringComparator())) {
if (!aDictionary.IsEmpty() && (mPreferredLang.IsEmpty() ||
!mPreferredLang.Equals(aDictionary,
nsCaseInsensitiveStringComparator()))) {
// When user sets dictionary manually, we store this value associated
// with editor url, if it doesn't match the document language exactly.
// For example on "en" sites, we need to store "en-GB", otherwise

Просмотреть файл

@ -5,7 +5,7 @@ skip-if = buildapp == 'b2g' || os == 'android'
[test_bug338427.html]
[test_bug434998.xul]
[test_bug678842.html]
[test_abug697981.html]
[test_bug697981.html]
[test_bug717433.html]
[test_bug1204147.html]
[test_bug1200533.html]

Просмотреть файл

@ -48,8 +48,11 @@ function start() {
sc.UpdateCurrentDictionary(function () {
is(sc.GetCurrentDictionary(), "",
"No dictionary should be active after Update.");
if (--numCalls == 0)
if (--numCalls == 0) {
// This will clear the content preferences and reset "spellchecker.dictionary".
sc.SetCurrentDictionary("");
SimpleTest.finish();
}
});
}
try {

Просмотреть файл

@ -42,6 +42,9 @@ function init() {
spellchecker.spellChecker.GetCurrentDictionary();
} catch(e) {}
is(dictionary, lang, "Unexpected spell check dictionary");
// This will clear the content preferences and reset "spellchecker.dictionary".
spellchecker.spellChecker.SetCurrentDictionary("");
SimpleTest.finish();
});
});

Просмотреть файл

@ -85,8 +85,8 @@ var loadListener = function(evt) {
// Remove the fake en-GB dictionary again, since it's otherwise picked up by later tests.
hunspell.removeDirectory(en_GB);
// Reset the preference, so the last value we set doesn't collide with the next test.
Services.prefs.setCharPref("spellchecker.dictionary", "");
// This will clear the content preferences and reset "spellchecker.dictionary".
spellchecker.SetCurrentDictionary("");
SimpleTest.finish();
}
});

Просмотреть файл

@ -29,11 +29,6 @@ var de_DE;
var hunspell;
/** Test for Bug 697981 **/
/*
* Note the hack: This test fails of there are content preferences left behind from previous tests.
* That's why this test resides in a file "test_abug697981.html" so it runs first.
* We will fix this later.
*/
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
Components.utils.import("resource://gre/modules/AsyncSpellCheckTestHelper.jsm");

Просмотреть файл

@ -32,7 +32,6 @@ var hunspell;
var loadListener = function(evt) {
Components.utils.import("resource://gre/modules/AsyncSpellCheckTestHelper.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
if (firstLoad) {
var dir = Components.classes["@mozilla.org/file/directory_service;1"]
@ -86,8 +85,8 @@ var loadListener = function(evt) {
// Remove the fake en-GB dictionary again, since it's otherwise picked up by later tests.
hunspell.removeDirectory(en_GB);
// Reset the preference, so the last value we set doesn't collide with the next test.
Services.prefs.setCharPref("spellchecker.dictionary", "");
// This will clear the content preferences and reset "spellchecker.dictionary".
spellchecker.SetCurrentDictionary("");
SimpleTest.finish();
}
});