diff --git a/CMakeLists.txt b/CMakeLists.txt index c05620db5f..5949021b95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,6 +83,11 @@ endif () add_subdirectory("source/proto") add_subdirectory("source/base") + +if (TACTILE_BUILD_TESTS) + add_subdirectory("source/test_util") +endif () + add_subdirectory("source/core") add_subdirectory("source/runtime") add_subdirectory("source/json_util") diff --git a/source/base/CMakeLists.txt b/source/base/CMakeLists.txt index a5ce930ffd..38848703f6 100644 --- a/source/base/CMakeLists.txt +++ b/source/base/CMakeLists.txt @@ -80,5 +80,4 @@ target_sources(tactile-base if (TACTILE_BUILD_TESTS) add_subdirectory("test") - add_subdirectory("test_util") endif () diff --git a/source/base/test_util/CMakeLists.txt b/source/base/test_util/CMakeLists.txt deleted file mode 100644 index d1f25cfd09..0000000000 --- a/source/base/test_util/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -project(tactile-base-test-util CXX) - -add_library(tactile-base-test-util STATIC) -add_library(tactile::base_test_util ALIAS tactile-base-test-util) - -target_sources(tactile-base-test-util - PRIVATE - "src/document_view_mocks.cpp" - "src/ir.cpp" - "src/ir_eq.cpp" - "src/ir_presets.cpp" - - PUBLIC FILE_SET "HEADERS" BASE_DIRS "inc" FILES - "inc/tactile/base/test_util/document_view_mocks.hpp" - "inc/tactile/base/test_util/ir.hpp" - "inc/tactile/base/test_util/ir_eq.hpp" - "inc/tactile/base/test_util/ir_presets.hpp" - ) - -tactile_prepare_target(tactile-base-test-util) - -target_link_libraries(tactile-base-test-util - PUBLIC - tactile::base - GTest::gtest - GTest::gmock - ) diff --git a/source/core/test/CMakeLists.txt b/source/core/test/CMakeLists.txt index 86ebb101bc..2ae7dd8f1d 100644 --- a/source/core/test/CMakeLists.txt +++ b/source/core/test/CMakeLists.txt @@ -58,7 +58,7 @@ tactile_prepare_target(tactile-core-test) target_link_libraries(tactile-core-test PRIVATE tactile::core - tactile::base_test_util + tactile::test_util tactile::null_renderer GTest::gtest ) diff --git a/source/core/test/src/layer/layer_common_test.cpp b/source/core/test/src/layer/layer_common_test.cpp index 01efbe8f9c..bb6eefc5b3 100644 --- a/source/core/test/src/layer/layer_common_test.cpp +++ b/source/core/test/src/layer/layer_common_test.cpp @@ -4,12 +4,12 @@ #include -#include "tactile/base/test_util/ir_presets.hpp" #include "tactile/core/entity/registry.hpp" #include "tactile/core/layer/group_layer.hpp" #include "tactile/core/layer/object_layer.hpp" #include "tactile/core/layer/tile_layer.hpp" #include "tactile/core/test/ir_comparison.hpp" +#include "tactile/test_util/ir_presets.hpp" namespace tactile::test { diff --git a/source/core/test/src/layer/object_test.cpp b/source/core/test/src/layer/object_test.cpp index 41c8352681..09099b0463 100644 --- a/source/core/test/src/layer/object_test.cpp +++ b/source/core/test/src/layer/object_test.cpp @@ -4,10 +4,10 @@ #include -#include "tactile/base/test_util/ir_presets.hpp" #include "tactile/core/entity/registry.hpp" #include "tactile/core/meta/meta.hpp" #include "tactile/core/test/ir_comparison.hpp" +#include "tactile/test_util/ir_presets.hpp" namespace tactile::test { diff --git a/source/core/test/src/map/map_test.cpp b/source/core/test/src/map/map_test.cpp index ca0c82b480..0c1fc99f7d 100644 --- a/source/core/test/src/map/map_test.cpp +++ b/source/core/test/src/map/map_test.cpp @@ -4,8 +4,6 @@ #include -#include "tactile/base/test_util/ir.hpp" -#include "tactile/base/test_util/ir_presets.hpp" #include "tactile/core/entity/registry.hpp" #include "tactile/core/layer/group_layer.hpp" #include "tactile/core/layer/layer.hpp" @@ -16,6 +14,8 @@ #include "tactile/core/tile/tileset_spec.hpp" #include "tactile/core/ui/viewport.hpp" #include "tactile/null_renderer/null_renderer.hpp" +#include "tactile/test_util/ir.hpp" +#include "tactile/test_util/ir_presets.hpp" namespace tactile::test { diff --git a/source/core/test/src/meta/meta_test.cpp b/source/core/test/src/meta/meta_test.cpp index 791fe57629..3f8e87ca04 100644 --- a/source/core/test/src/meta/meta_test.cpp +++ b/source/core/test/src/meta/meta_test.cpp @@ -5,9 +5,9 @@ #include #include -#include "tactile/base/test_util/ir_presets.hpp" #include "tactile/core/entity/registry.hpp" #include "tactile/core/test/ir_comparison.hpp" +#include "tactile/test_util/ir_presets.hpp" namespace tactile::test { diff --git a/source/core/test/src/tile/tile_test.cpp b/source/core/test/src/tile/tile_test.cpp index 47d0be7122..eaa176718b 100644 --- a/source/core/test/src/tile/tile_test.cpp +++ b/source/core/test/src/tile/tile_test.cpp @@ -4,12 +4,12 @@ #include -#include "tactile/base/test_util/ir_presets.hpp" #include "tactile/core/entity/registry.hpp" #include "tactile/core/layer/object.hpp" #include "tactile/core/meta/meta.hpp" #include "tactile/core/test/ir_comparison.hpp" #include "tactile/core/tile/animation.hpp" +#include "tactile/test_util/ir_presets.hpp" namespace tactile::test { diff --git a/source/core/test/src/tile/tileset_test.cpp b/source/core/test/src/tile/tileset_test.cpp index 60e1129df0..425c0cbae3 100644 --- a/source/core/test/src/tile/tileset_test.cpp +++ b/source/core/test/src/tile/tileset_test.cpp @@ -5,7 +5,6 @@ #include #include "tactile/base/numeric/saturate_cast.hpp" -#include "tactile/base/test_util/ir_presets.hpp" #include "tactile/core/entity/registry.hpp" #include "tactile/core/io/texture.hpp" #include "tactile/core/meta/meta.hpp" @@ -15,6 +14,7 @@ #include "tactile/core/tile/tileset_spec.hpp" #include "tactile/core/ui/viewport.hpp" #include "tactile/null_renderer/null_renderer.hpp" +#include "tactile/test_util/ir_presets.hpp" namespace tactile::test { diff --git a/source/base/test_util/.clang-tidy b/source/test_util/.clang-tidy similarity index 100% rename from source/base/test_util/.clang-tidy rename to source/test_util/.clang-tidy diff --git a/source/test_util/CMakeLists.txt b/source/test_util/CMakeLists.txt new file mode 100644 index 0000000000..4ec0dd2817 --- /dev/null +++ b/source/test_util/CMakeLists.txt @@ -0,0 +1,27 @@ +project(tactile-test-util CXX) + +add_library(tactile-test-util STATIC) +add_library(tactile::test_util ALIAS tactile-test-util) + +target_sources(tactile-test-util + PRIVATE + "src/document_view_mocks.cpp" + "src/ir.cpp" + "src/ir_eq.cpp" + "src/ir_presets.cpp" + + PUBLIC FILE_SET "HEADERS" BASE_DIRS "inc" FILES + "inc/tactile/test_util/document_view_mocks.hpp" + "inc/tactile/test_util/ir.hpp" + "inc/tactile/test_util/ir_eq.hpp" + "inc/tactile/test_util/ir_presets.hpp" + ) + +tactile_prepare_target(tactile-test-util) + +target_link_libraries(tactile-test-util + PUBLIC + tactile::base + GTest::gtest + GTest::gmock + ) diff --git a/source/base/test_util/inc/tactile/base/test_util/document_view_mocks.hpp b/source/test_util/inc/tactile/test_util/document_view_mocks.hpp similarity index 100% rename from source/base/test_util/inc/tactile/base/test_util/document_view_mocks.hpp rename to source/test_util/inc/tactile/test_util/document_view_mocks.hpp diff --git a/source/base/test_util/inc/tactile/base/test_util/ir.hpp b/source/test_util/inc/tactile/test_util/ir.hpp similarity index 100% rename from source/base/test_util/inc/tactile/base/test_util/ir.hpp rename to source/test_util/inc/tactile/test_util/ir.hpp diff --git a/source/base/test_util/inc/tactile/base/test_util/ir_eq.hpp b/source/test_util/inc/tactile/test_util/ir_eq.hpp similarity index 100% rename from source/base/test_util/inc/tactile/base/test_util/ir_eq.hpp rename to source/test_util/inc/tactile/test_util/ir_eq.hpp diff --git a/source/base/test_util/inc/tactile/base/test_util/ir_presets.hpp b/source/test_util/inc/tactile/test_util/ir_presets.hpp similarity index 100% rename from source/base/test_util/inc/tactile/base/test_util/ir_presets.hpp rename to source/test_util/inc/tactile/test_util/ir_presets.hpp diff --git a/source/base/test_util/src/document_view_mocks.cpp b/source/test_util/src/document_view_mocks.cpp similarity index 99% rename from source/base/test_util/src/document_view_mocks.cpp rename to source/test_util/src/document_view_mocks.cpp index 20c6ed4e0d..5ed1a8b4b8 100644 --- a/source/base/test_util/src/document_view_mocks.cpp +++ b/source/test_util/src/document_view_mocks.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2024 Albin Johansson (GNU General Public License v3.0) -#include "tactile/base/test_util/document_view_mocks.hpp" +#include "tactile/test_util/document_view_mocks.hpp" #include // move diff --git a/source/base/test_util/src/ir.cpp b/source/test_util/src/ir.cpp similarity index 98% rename from source/base/test_util/src/ir.cpp rename to source/test_util/src/ir.cpp index cfa8cb8ebf..cf74b483c9 100644 --- a/source/base/test_util/src/ir.cpp +++ b/source/test_util/src/ir.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2024 Albin Johansson (GNU General Public License v3.0) -#include "tactile/base/test_util/ir.hpp" +#include "tactile/test_util/ir.hpp" #include // format #include // move diff --git a/source/base/test_util/src/ir_eq.cpp b/source/test_util/src/ir_eq.cpp similarity index 99% rename from source/base/test_util/src/ir_eq.cpp rename to source/test_util/src/ir_eq.cpp index 1719062841..1fabda39ed 100644 --- a/source/base/test_util/src/ir_eq.cpp +++ b/source/test_util/src/ir_eq.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2024 Albin Johansson (GNU General Public License v3.0) -#include "tactile/base/test_util/ir_eq.hpp" +#include "tactile/test_util/ir_eq.hpp" #include // find_if #include // format diff --git a/source/base/test_util/src/ir_presets.cpp b/source/test_util/src/ir_presets.cpp similarity index 98% rename from source/base/test_util/src/ir_presets.cpp rename to source/test_util/src/ir_presets.cpp index a87513e84b..5445cdaa5d 100644 --- a/source/base/test_util/src/ir_presets.cpp +++ b/source/test_util/src/ir_presets.cpp @@ -1,10 +1,10 @@ // Copyright (C) 2024 Albin Johansson (GNU General Public License v3.0) -#include "tactile/base/test_util/ir_presets.hpp" +#include "tactile/test_util/ir_presets.hpp" #include // move -#include "tactile/base/test_util/ir.hpp" +#include "tactile/test_util/ir.hpp" namespace tactile::test { diff --git a/source/tiled_tmj_format/test/CMakeLists.txt b/source/tiled_tmj_format/test/CMakeLists.txt index d6701ec643..9f765e158e 100644 --- a/source/tiled_tmj_format/test/CMakeLists.txt +++ b/source/tiled_tmj_format/test/CMakeLists.txt @@ -24,7 +24,7 @@ tactile_prepare_target(tactile-tiled-tmj-format-test) target_link_libraries(tactile-tiled-tmj-format-test PRIVATE tactile::tiled_tmj_format - tactile::base_test_util + tactile::test_util tactile::null_renderer $<$:tactile::zlib_compression> $<$:tactile::zstd_compression> diff --git a/source/tiled_tmj_format/test/src/tmj_format_layer_emitter_test.cpp b/source/tiled_tmj_format/test/src/tmj_format_layer_emitter_test.cpp index 086751d8c0..85106f3c6a 100644 --- a/source/tiled_tmj_format/test/src/tmj_format_layer_emitter_test.cpp +++ b/source/tiled_tmj_format/test/src/tmj_format_layer_emitter_test.cpp @@ -7,9 +7,9 @@ #include "tactile/base/io/tile_io.hpp" #include "tactile/base/platform/bits.hpp" -#include "tactile/base/test_util/document_view_mocks.hpp" -#include "tactile/base/test_util/ir.hpp" #include "tactile/runtime/runtime.hpp" +#include "tactile/test_util/document_view_mocks.hpp" +#include "tactile/test_util/ir.hpp" #ifdef TACTILE_HAS_ZLIB_COMPRESSION #include "tactile/zlib_compression/zlib_compression_plugin.hpp" diff --git a/source/tiled_tmj_format/test/src/tmj_format_map_emitter_test.cpp b/source/tiled_tmj_format/test/src/tmj_format_map_emitter_test.cpp index eae382c338..94ebe502fe 100644 --- a/source/tiled_tmj_format/test/src/tmj_format_map_emitter_test.cpp +++ b/source/tiled_tmj_format/test/src/tmj_format_map_emitter_test.cpp @@ -5,8 +5,8 @@ #include #include -#include "tactile/base/test_util/document_view_mocks.hpp" -#include "tactile/base/test_util/ir.hpp" +#include "tactile/test_util/document_view_mocks.hpp" +#include "tactile/test_util/ir.hpp" namespace tactile::test { diff --git a/source/tiled_tmj_format/test/src/tmj_format_meta_emitter_test.cpp b/source/tiled_tmj_format/test/src/tmj_format_meta_emitter_test.cpp index 01fcc21a08..722282f9bd 100644 --- a/source/tiled_tmj_format/test/src/tmj_format_meta_emitter_test.cpp +++ b/source/tiled_tmj_format/test/src/tmj_format_meta_emitter_test.cpp @@ -6,7 +6,7 @@ #include #include "tactile/base/meta/attribute.hpp" -#include "tactile/base/test_util/document_view_mocks.hpp" +#include "tactile/test_util/document_view_mocks.hpp" namespace tactile::test { diff --git a/source/tiled_tmj_format/test/src/tmj_format_object_emitter_test.cpp b/source/tiled_tmj_format/test/src/tmj_format_object_emitter_test.cpp index abd2c7c786..8d7890d2e9 100644 --- a/source/tiled_tmj_format/test/src/tmj_format_object_emitter_test.cpp +++ b/source/tiled_tmj_format/test/src/tmj_format_object_emitter_test.cpp @@ -6,7 +6,7 @@ #include #include "tactile/base/meta/attribute.hpp" -#include "tactile/base/test_util/document_view_mocks.hpp" +#include "tactile/test_util/document_view_mocks.hpp" namespace tactile::test { diff --git a/source/tiled_tmj_format/test/src/tmj_format_roundtrip_test.cpp b/source/tiled_tmj_format/test/src/tmj_format_roundtrip_test.cpp index 2526c37926..9aa625beb1 100644 --- a/source/tiled_tmj_format/test/src/tmj_format_roundtrip_test.cpp +++ b/source/tiled_tmj_format/test/src/tmj_format_roundtrip_test.cpp @@ -8,10 +8,10 @@ #include "tactile/base/container/maybe.hpp" #include "tactile/base/container/string.hpp" -#include "tactile/base/test_util/document_view_mocks.hpp" -#include "tactile/base/test_util/ir.hpp" -#include "tactile/base/test_util/ir_eq.hpp" -#include "tactile/base/test_util/ir_presets.hpp" +#include "tactile/test_util/document_view_mocks.hpp" +#include "tactile/test_util/ir.hpp" +#include "tactile/test_util/ir_eq.hpp" +#include "tactile/test_util/ir_presets.hpp" #include "tactile/runtime/runtime.hpp" #include "tactile/tiled_tmj_format/tmj_format_plugin.hpp" diff --git a/source/tiled_tmj_format/test/src/tmj_format_tile_emitter_test.cpp b/source/tiled_tmj_format/test/src/tmj_format_tile_emitter_test.cpp index 99df5f0539..0cbcb1c4d8 100644 --- a/source/tiled_tmj_format/test/src/tmj_format_tile_emitter_test.cpp +++ b/source/tiled_tmj_format/test/src/tmj_format_tile_emitter_test.cpp @@ -5,8 +5,8 @@ #include #include -#include "tactile/base/test_util/document_view_mocks.hpp" -#include "tactile/base/test_util/ir.hpp" +#include "tactile/test_util/document_view_mocks.hpp" +#include "tactile/test_util/ir.hpp" namespace tactile::test { diff --git a/source/tiled_tmj_format/test/src/tmj_format_tileset_emitter_test.cpp b/source/tiled_tmj_format/test/src/tmj_format_tileset_emitter_test.cpp index 2d0d5dfaa3..a980b9b452 100644 --- a/source/tiled_tmj_format/test/src/tmj_format_tileset_emitter_test.cpp +++ b/source/tiled_tmj_format/test/src/tmj_format_tileset_emitter_test.cpp @@ -5,7 +5,7 @@ #include #include -#include "tactile/base/test_util/document_view_mocks.hpp" +#include "tactile/test_util/document_view_mocks.hpp" namespace tactile::test {