summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt4
-rw-r--r--Tests/FindFontconfig/CMakeLists.txt10
-rw-r--r--Tests/FindFontconfig/Test/CMakeLists.txt16
-rw-r--r--Tests/FindFontconfig/Test/main.c17
4 files changed, 47 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 9e192be..6614933 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1376,6 +1376,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
add_subdirectory(FindEXPAT)
endif()
+ if(CMake_TEST_FindFontconfig)
+ add_subdirectory(FindFontconfig)
+ endif()
+
if(CMake_TEST_FindFreetype)
add_subdirectory(FindFreetype)
endif()
diff --git a/Tests/FindFontconfig/CMakeLists.txt b/Tests/FindFontconfig/CMakeLists.txt
new file mode 100644
index 0000000..d683d87
--- /dev/null
+++ b/Tests/FindFontconfig/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindFontconfig.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindFontconfig/Test"
+ "${CMake_BINARY_DIR}/Tests/FindFontconfig/Test"
+ ${build_generator_args}
+ --build-project TestFindFontconfig
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindFontconfig/Test/CMakeLists.txt b/Tests/FindFontconfig/Test/CMakeLists.txt
new file mode 100644
index 0000000..81db3ba
--- /dev/null
+++ b/Tests/FindFontconfig/Test/CMakeLists.txt
@@ -0,0 +1,16 @@
+cmake_minimum_required(VERSION 3.10)
+project(TestFindFontconfig C)
+include(CTest)
+
+find_package(Fontconfig REQUIRED)
+
+add_definitions(-DCMAKE_EXPECTED_FONTCONFIG_VERSION="${FONTCONFIG_VERSION}")
+
+add_executable(test_tgt main.c)
+target_link_libraries(test_tgt Fontconfig::Fontconfig)
+add_test(NAME test_tgt COMMAND test_tgt)
+
+add_executable(test_var main.c)
+target_include_directories(test_var PRIVATE ${FONTCONFIG_INCLUDE_DIRS})
+target_link_libraries(test_var PRIVATE ${FONTCONFIG_LIBRARIES})
+add_test(NAME test_var COMMAND test_var)
diff --git a/Tests/FindFontconfig/Test/main.c b/Tests/FindFontconfig/Test/main.c
new file mode 100644
index 0000000..c5b5963
--- /dev/null
+++ b/Tests/FindFontconfig/Test/main.c
@@ -0,0 +1,17 @@
+#include <assert.h>
+#include <fontconfig/fontconfig.h>
+#include <stdio.h>
+#include <string.h>
+
+int main()
+{
+ FcInit();
+ printf("Found Fontconfig.\n");
+
+ char fontconfig_version_string[16];
+ snprintf(fontconfig_version_string, 16, "%i.%i.%i", FC_MAJOR, FC_MINOR,
+ FC_REVISION);
+ assert(
+ strcmp(fontconfig_version_string, CMAKE_EXPECTED_FONTCONFIG_VERSION) == 0);
+ return 0;
+}