From e4acb3f77f12e0d42fb8084dafbf5de59f7a1c1b Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Mon, 12 Feb 2018 12:18:53 +0100 Subject: Add test for FontContext/FontGroup functionality Unfortunately, this required quite a bit of changes to the non-test code. That's because FontContext depends on a FontCacheThread, which in turn depends on a CoreResourceThread and therefore lots of other data structures. It seemed like it would be very difficult to instantiate a FontContext as it was, and even if we could it seems like overkill to have all these data structures present for a relatively focused test. Therefore, I created a FontSource trait which represents the interface which FontContext uses to talk to FontCacheThread. FontCacheThread then implements FontSource. Then, in the test, we can create a dummy implementation of FontSource rather than using FontCacheThread. This actually has the advantage that we can make our dummy implementation behave in certain specific way which are useful for testing, for example it can count the number of times find_font_template() is called, which helps us verify that caching/lazy-loading is working as intended. --- .../gfx/tests/support/CSSTest/csstest-weights-400.ttf | Bin 0 -> 8364 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 components/gfx/tests/support/CSSTest/csstest-weights-400.ttf (limited to 'components/gfx/tests/support/CSSTest/csstest-weights-400.ttf') diff --git a/components/gfx/tests/support/CSSTest/csstest-weights-400.ttf b/components/gfx/tests/support/CSSTest/csstest-weights-400.ttf new file mode 100644 index 00000000000..9938a378bd6 Binary files /dev/null and b/components/gfx/tests/support/CSSTest/csstest-weights-400.ttf differ -- cgit v1.2.3