diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /devtools/client/inspector/fonts/test/browser_fontinspector_all-fonts.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/inspector/fonts/test/browser_fontinspector_all-fonts.js')
-rw-r--r-- | devtools/client/inspector/fonts/test/browser_fontinspector_all-fonts.js | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/devtools/client/inspector/fonts/test/browser_fontinspector_all-fonts.js b/devtools/client/inspector/fonts/test/browser_fontinspector_all-fonts.js new file mode 100644 index 0000000000..7f2acfaebb --- /dev/null +++ b/devtools/client/inspector/fonts/test/browser_fontinspector_all-fonts.js @@ -0,0 +1,82 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + +// Check that the font editor has a section for "All fonts" which shows all fonts +// used on the page. + +const TEST_URI = URL_ROOT_SSL + "doc_browser_fontinspector.html"; + +add_task(async function () { + const { view } = await openFontInspectorForURL(TEST_URI); + const viewDoc = view.document; + + const allFontsAccordion = getFontsAccordion(viewDoc); + ok(allFontsAccordion, "There's an accordion in the panel"); + is( + allFontsAccordion.textContent, + "All Fonts on Page", + "It has the right title" + ); + + await expandAccordion(allFontsAccordion); + const allFontsEls = getAllFontsEls(viewDoc); + + const FONTS = [ + { + familyName: ["bar"], + name: ["Ostrich Sans Medium"], + remote: true, + url: URL_ROOT_SSL + "ostrich-regular.ttf", + }, + { + familyName: ["bar"], + name: ["Ostrich Sans Black"], + remote: true, + url: URL_ROOT_SSL + "ostrich-black.ttf", + }, + { + familyName: ["bar"], + name: ["Ostrich Sans Black"], + remote: true, + url: URL_ROOT_SSL + "ostrich-black.ttf", + }, + { + familyName: ["barnormal"], + name: ["Ostrich Sans Medium"], + remote: true, + url: URL_ROOT_SSL + "ostrich-regular.ttf", + }, + { + // On Linux, Arial does not exist. Liberation Sans is used instead. + familyName: ["Arial", "Liberation Sans"], + name: ["Arial", "Liberation Sans"], + remote: false, + url: "system", + }, + { + // On Linux, Times New Roman does not exist. Liberation Serif is used instead. + familyName: ["Times New Roman", "Liberation Serif"], + name: ["Times New Roman", "Liberation Serif"], + remote: false, + url: "system", + }, + ]; + + is(allFontsEls.length, FONTS.length, "All fonts used are listed"); + + for (let i = 0; i < FONTS.length; i++) { + const li = allFontsEls[i]; + const font = FONTS[i]; + + ok(font.name.includes(getName(li)), "The DIV font has the right name"); + info(getName(li)); + ok( + font.familyName.includes(getFamilyName(li)), + `font has the right family name` + ); + info(getFamilyName(li)); + is(isRemote(li), font.remote, `font remote value correct`); + is(getURL(li), font.url, `font url correct`); + } +}); |