Bug 698238 - test-font-chooser.js fails on Windows after bug 454532. r=Standard8
authorSiddharth Agarwal <sagarwal@mozilla.com>
Mon, 31 Oct 2011 19:19:11 +0530
changeset 9591 2ac65ac0ab684a9504f673a93a2365c612d30816
parent 9590 c63ad16c02bcc15aea1469c0f0dc7e1fd9dc353f
child 9592 e535f63f9c7e3089b581acad4d45456c5b171475
push id281
push userbugzilla@standard8.plus.com
push dateWed, 21 Dec 2011 12:08:36 +0000
treeherdercomm-beta@6d973fa5c2e8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8
bugs698238, 454532
Bug 698238 - test-font-chooser.js fails on Windows after bug 454532. r=Standard8
mail/test/mozmill/pref-window/test-font-chooser.js
--- a/mail/test/mozmill/pref-window/test-font-chooser.js
+++ b/mail/test/mozmill/pref-window/test-font-chooser.js
@@ -103,21 +103,16 @@ function assert_fonts_equal(aDescription
  * and checks that too.
  */
 function _verify_fonts_displayed(aSerif, aSansSerif, aMonospace) {
   function verify_display_pane(prefc) {
     let isSansDefault = (gPrefBranch.getCharPref("font.default." + kLanguage) ==
                          "sans-serif");
     let displayPaneExpected = isSansDefault ? aSansSerif : aSerif;
     let displayPaneActual = prefc.e("defaultFont").value;
-    // Bug 454532 made us use Courier New rather than Courier on Windows as
-    // the default font in some instances. Account for that here.
-    if (mc.mozmillModule.isWindows &&
-        displayPaneExpected == "Courier")
-      displayPaneExpected = "Courier New";
     assert_fonts_equal("display pane", displayPaneExpected, displayPaneActual);
   }
 
   // Bring up the preferences window.
   open_pref_window("paneDisplay", verify_display_pane);
 
   // Now verify the advanced dialog.
   function verify_advanced(fontc) {
@@ -142,19 +137,23 @@ function _verify_fonts_displayed(aSerif,
  * present on the cocomputer).
  */
 function test_font_name_displayed() {
   gPrefBranch.setCharPref("font.language.group", kLanguage);
 
   // Pick the first font for each font type and set it.
   let expected = {};
   for (let [fontType, fontList] in Iterator(gRealFontLists)) {
+    // Work around bug 698238 (on Windows, Courier is returned by the enumerator but
+    // substituted with Courier New) by getting the standard (substituted) family
+    // name for each font.
+    let standardFamily = gFontEnumerator.getStandardFamilyName(fontList[0]);
     gPrefBranch.setCharPref("font.name." + fontType + "." + kLanguage,
-                            fontList[0]);
-    expected[fontType] = fontList[0];
+                            standardFamily);
+    expected[fontType] = standardFamily;
   }
 
   _verify_fonts_displayed.apply(null, [expected[k]
                                        for ([, k] in Iterator(kFontTypes))]);
 }
 
 // Fonts definitely not present on a computer -- we simply use UUIDs. These
 // should be kept in sync with the ones in *-prefs.js.