Skip to content

Commit db2721a

Browse files
committed
Make tests working on wasm instead of commenting them out ?
1 parent 9f2fb6f commit db2721a

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

tests/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ set (target_name yup_tests)
5252
set (target_version "1.0.0")
5353
set (target_console OFF)
5454
set (target_gtest_modules "")
55+
set (target_preloaded "")
5556
set (target_modules
5657
yup_core
5758
yup_audio_basics
@@ -76,6 +77,12 @@ else()
7677
list (APPEND target_gtest_modules
7778
GTest::gtest_main
7879
GTest::gmock_main)
80+
81+
file (GLOB_RECURSE data_files "${CMAKE_CURRENT_LIST_DIR}/data/*")
82+
foreach (data_file ${data_files})
83+
file (RELATIVE_PATH rel_path "${CMAKE_CURRENT_LIST_DIR}" "${data_file}")
84+
list (APPEND target_preloaded "${data_file}@${rel_path}")
85+
endforeach()
7986
endif()
8087

8188
if (YUP_PLATFORM_MAC) # OR YUP_PLATFORM_WINDOWS)
@@ -105,11 +112,13 @@ yup_standalone_app (
105112
DEFINITIONS
106113
YUP_USE_CURL=0
107114
YUP_MODAL_LOOPS_PERMITTED=1
115+
PRELOAD_FILES
116+
${target_preloaded}
108117
MODULES
109118
${target_modules}
110119
${target_gtest_modules})
111120

112-
# ==== (Only For Testing) Setup FFTW3
121+
# ==== (Only For Manual Testing) Setup FFTW3
113122
# _yup_find_fftw3 (${target_name})
114123

115124
# ==== Setup sources

tests/yup_graphics/yup_Font.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,17 @@ namespace
2929
{
3030
File getValidFontFile()
3131
{
32-
return File (__FILE__)
33-
.getParentDirectory()
34-
.getParentDirectory()
35-
.getChildFile ("data")
36-
.getChildFile ("fonts")
37-
.getChildFile ("Linefont-VariableFont_wdth,wght.ttf");
32+
return
33+
#if YUP_EMSCRIPTEN
34+
File ("/")
35+
#else
36+
File (__FILE__)
37+
#endif
38+
.getParentDirectory()
39+
.getParentDirectory()
40+
.getChildFile ("data")
41+
.getChildFile ("fonts")
42+
.getChildFile ("Linefont-VariableFont_wdth,wght.ttf");
3843
}
3944
} // namespace
4045

0 commit comments

Comments
 (0)