Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c84bcef0 authored by Seigo Nonaka's avatar Seigo Nonaka
Browse files

Fix UpdatableFontDirTest

new font_fallback.xml is not readable from the app process,
use legacy fonts.xml for testing.

Bug: N/A
Test: atest UpdatableFontDirTest
Change-Id: Id7ca793c44007ad8b9d7b10ba5f28256017a130b
parent 86ada35b
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -234,6 +234,22 @@ public final class SystemFonts {
                updatableFontMap, lastModifiedDate, configVersion);
    }

    /**
     * Get the updated FontConfig.
     *
     * @param updatableFontMap a font mapping of updated font files.
     * @hide
     */
    public static @NonNull FontConfig getSystemFontConfigForTesting(
            @NonNull String fontsXml,
            @Nullable Map<String, File> updatableFontMap,
            long lastModifiedDate,
            int configVersion
    ) {
        return getSystemFontConfigInternal(fontsXml, SYSTEM_FONT_DIR, OEM_XML, OEM_FONT_DIR,
                updatableFontMap, lastModifiedDate, configVersion);
    }

    /**
     * Get the system preinstalled FontConfig.
     * @hide
+3 −1
Original line number Diff line number Diff line
@@ -67,6 +67,8 @@ import java.util.stream.Collectors;
@RunWith(AndroidJUnit4.class)
public final class UpdatableFontDirTest {

    private static final String LEGACY_FONTS_XML = "/system/etc/fonts.xml";

    /**
     * A {@link UpdatableFontDir.FontFileParser} for testing. Instead of using real font files,
     * this test uses fake font files. A fake font file has its PostScript naem and revision as the
@@ -140,7 +142,7 @@ public final class UpdatableFontDirTest {
    private List<File> mPreinstalledFontDirs;
    private final Supplier<Long> mCurrentTimeSupplier = () -> CURRENT_TIME;
    private final Function<Map<String, File>, FontConfig> mConfigSupplier =
            (map) -> SystemFonts.getSystemFontConfig(map, 0, 0);
            (map) -> SystemFonts.getSystemFontConfigForTesting(LEGACY_FONTS_XML, map, 0, 0);
    private FakeFontFileParser mParser;
    private FakeFsverityUtil mFakeFsverityUtil;