From 01c7dcc124296b1fbf1abb8af115d92021b0e6cd Mon Sep 17 00:00:00 2001 From: Seigo Nonaka Date: Mon, 7 Dec 2015 10:28:31 -0800 Subject: [PATCH] Copy test font files into data directory. To work native tests with additional font related files, copy the files into /data/nativetest/minikin_tests/. This copy only happens when the minikin_tests is built. It is not an expected to copy the font files into the product image. Change-Id: I7d83abc077bce4e38fd93c7d607bc7e1f7871e6b --- engine/src/flutter/tests/Android.mk | 40 ++++++++++++++++++- .../tests/FontCollectionItemizeTest.cpp | 2 - .../src/flutter/tests/FontCollectionTest.cpp | 2 +- engine/src/flutter/tests/FontFamilyTest.cpp | 2 +- engine/src/flutter/tests/how_to_run.txt | 2 +- 5 files changed, 42 insertions(+), 6 deletions(-) diff --git a/engine/src/flutter/tests/Android.mk b/engine/src/flutter/tests/Android.mk index 2eb2abe2a2..044e65de2e 100644 --- a/engine/src/flutter/tests/Android.mk +++ b/engine/src/flutter/tests/Android.mk @@ -16,12 +16,49 @@ LOCAL_PATH := $(call my-dir) +data_root_for_test_zip := $(TARGET_OUT_DATA)/DATA/ +minikin_tests_subpath_from_data := nativetest/minikin_tests +minikin_tests_root_in_device := /data/$(minikin_tests_subpath_from_data) +minikin_tests_root_for_test_zip := $(data_root_for_test_zip)/$(minikin_tests_subpath_from_data) + +define build-one-test-font-module +$(eval include $(CLEAR_VARS))\ +$(eval LOCAL_MODULE := $(1))\ +$(eval LOCAL_SRC_FILES := $(1))\ +$(eval LOCAL_MODULE_CLASS := ETC)\ +$(eval LOCAL_MODULE_TAGS := tests)\ +$(eval LOCAL_MODULE_PATH := $(minikin_tests_root_for_test_zip))\ +$(eval include $(BUILD_PREBUILT)) +endef + +font_src_files := \ + data/BoldItalic.ttf \ + data/Bold.ttf \ + data/ColorEmojiFont.ttf \ + data/ColorTextMixedEmojiFont.ttf \ + data/Emoji.ttf \ + data/Italic.ttf \ + data/Ja.ttf \ + data/Ko.ttf \ + data/NoGlyphFont.ttf \ + data/Regular.ttf \ + data/TextEmojiFont.ttf \ + data/VarioationSelectorTest-Regular.ttf \ + data/ZhHans.ttf \ + data/ZhHant.ttf \ + data/itemize.xml \ + data/emoji.xml + +$(foreach f, $(font_src_files), $(call build-one-test-font-module, $(f))) + include $(CLEAR_VARS) LOCAL_MODULE := minikin_tests LOCAL_MODULE_TAGS := tests LOCAL_STATIC_LIBRARIES := libminikin +LOCAL_ADDITIONAL_DEPENDENCIES = $(font_src_files) +LOCAL_PICKUP_FILES := $(data_root_for_test_zip) # Shared libraries which are dependencies of minikin; these are not automatically # pulled in by the build system (and thus sadly must be repeated). @@ -56,6 +93,7 @@ LOCAL_C_INCLUDES := \ external/libxml2/include \ external/skia/src/core -LOCAL_CPPFLAGS += -Werror -Wall -Wextra +LOCAL_CPPFLAGS += -Werror -Wall -Wextra \ + -DkTestFontDir="\"$(minikin_tests_root_in_device)/data/\"" include $(BUILD_NATIVE_TEST) diff --git a/engine/src/flutter/tests/FontCollectionItemizeTest.cpp b/engine/src/flutter/tests/FontCollectionItemizeTest.cpp index d0dc39c974..57ed6ee33d 100644 --- a/engine/src/flutter/tests/FontCollectionItemizeTest.cpp +++ b/engine/src/flutter/tests/FontCollectionItemizeTest.cpp @@ -25,8 +25,6 @@ using android::FontFamily; using android::FontLanguage; using android::FontStyle; -#define kTestFontDir "/data/minikin/test/data/" - const char kItemizeFontXml[] = kTestFontDir "itemize.xml"; const char kEmojiFont[] = kTestFontDir "Emoji.ttf"; const char kJAFont[] = kTestFontDir "Ja.ttf"; diff --git a/engine/src/flutter/tests/FontCollectionTest.cpp b/engine/src/flutter/tests/FontCollectionTest.cpp index 593575617f..bbc53e3645 100644 --- a/engine/src/flutter/tests/FontCollectionTest.cpp +++ b/engine/src/flutter/tests/FontCollectionTest.cpp @@ -37,7 +37,7 @@ namespace android { // U+717D U+FE02 (VS3) // U+717D U+E0102 (VS19) // U+717D U+E0103 (VS20) -const char kVsTestFont[] = "/data/minikin/test/data/VarioationSelectorTest-Regular.ttf"; +const char kVsTestFont[] = kTestFontDir "/VarioationSelectorTest-Regular.ttf"; void expectVSGlyphs(const FontCollection& fc, uint32_t codepoint, const std::set& vsSet) { for (uint32_t vs = 0xFE00; vs <= 0xE01EF; ++vs) { diff --git a/engine/src/flutter/tests/FontFamilyTest.cpp b/engine/src/flutter/tests/FontFamilyTest.cpp index fa8302c60c..fc44e6c636 100644 --- a/engine/src/flutter/tests/FontFamilyTest.cpp +++ b/engine/src/flutter/tests/FontFamilyTest.cpp @@ -120,7 +120,7 @@ TEST(FontLanguagesTest, registerLanguageListTest) { // U+717D U+FE02 (VS3) // U+717D U+E0102 (VS19) // U+717D U+E0103 (VS20) -const char kVsTestFont[] = "/data/minikin/test/data/VarioationSelectorTest-Regular.ttf"; +const char kVsTestFont[] = kTestFontDir "VarioationSelectorTest-Regular.ttf"; class FontFamilyTest : public testing::Test { public: diff --git a/engine/src/flutter/tests/how_to_run.txt b/engine/src/flutter/tests/how_to_run.txt index 09c3b0614e..a135c30e13 100644 --- a/engine/src/flutter/tests/how_to_run.txt +++ b/engine/src/flutter/tests/how_to_run.txt @@ -1,5 +1,5 @@ mmm -j8 frameworks/minikin/tests && adb push $OUT/data/nativetest/minikin_tests/minikin_tests \ /data/nativetest/minikin_tests/minikin_tests && -adb push -p frameworks/minikin/tests/data /data/minikin/test/data && +adb push frameworks/minikin/tests/data /data/nativetest/minikin_tests/data && adb shell /data/nativetest/minikin_tests/minikin_tests