summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/envs/opengl/CMakeLists.txt13
-rw-r--r--test/envs/opengl/README.txt2
-rw-r--r--test/envs/opengl/light_test.cpp3
-rw-r--r--test/envs/opengl/model_test.cpp5
-rw-r--r--test/envs/opengl/transform_test.cpp3
-rw-r--r--test/unit/CMakeLists.txt10
-rw-r--r--test/unit/common/CMakeLists.txt11
-rw-r--r--test/unit/ui/CMakeLists.txt5
8 files changed, 25 insertions, 27 deletions
diff --git a/test/envs/opengl/CMakeLists.txt b/test/envs/opengl/CMakeLists.txt
index 2855318..a78962c 100644
--- a/test/envs/opengl/CMakeLists.txt
+++ b/test/envs/opengl/CMakeLists.txt
@@ -2,15 +2,6 @@ set(SRC_DIR ${colobot_SOURCE_DIR}/src)
configure_file(${SRC_DIR}/common/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/common/config.h)
-# Platform-dependent implementation of system.h
-if(PLATFORM_WINDOWS)
- set(SYSTEM_CPP_MODULE "system_windows.cpp")
-elseif(PLATFORM_LINUX)
- set(SYSTEM_CPP_MODULE "system_linux.cpp")
-else()
- set(SYSTEM_CPP_MODULE "system_other.cpp")
-endif()
-
set(TEXTURE_SOURCES
${SRC_DIR}/graphics/core/color.cpp
${SRC_DIR}/graphics/opengl/gldevice.cpp
@@ -28,6 +19,7 @@ ${SRC_DIR}/common/image.cpp
${SRC_DIR}/common/stringutils.cpp
${SRC_DIR}/app/system.cpp
${SRC_DIR}/app/${SYSTEM_CPP_MODULE}
+${SRC_DIR}/app/system_other.cpp
model_test.cpp
)
@@ -38,6 +30,7 @@ ${SRC_DIR}/common/logger.cpp
${SRC_DIR}/common/image.cpp
${SRC_DIR}/app/system.cpp
${SRC_DIR}/app/${SYSTEM_CPP_MODULE}
+${SRC_DIR}/app/system_other.cpp
transform_test.cpp
)
@@ -48,6 +41,7 @@ ${SRC_DIR}/common/logger.cpp
${SRC_DIR}/common/image.cpp
${SRC_DIR}/app/system.cpp
${SRC_DIR}/app/${SYSTEM_CPP_MODULE}
+${SRC_DIR}/app/system_other.cpp
light_test.cpp
)
@@ -68,6 +62,7 @@ ${SDLIMAGE_LIBRARY}
${OPENGL_LIBRARY}
${GLEW_LIBRARY}
${PNG_LIBRARIES}
+${Boost_LIBRARIES}
)
add_executable(texture_test ${TEXTURE_SOURCES})
diff --git a/test/envs/opengl/README.txt b/test/envs/opengl/README.txt
index c618415..f64f185 100644
--- a/test/envs/opengl/README.txt
+++ b/test/envs/opengl/README.txt
@@ -1,7 +1,7 @@
Test programs for OpenGL engine:
- texture_test -> multitexturing test with 2 textures (included as files: ./tex1.png, ./tex2.png)
- model_test -> simple model viewer to test model loading
- usage: ./model_test {dxf|mod} model_file
+ usage: ./model_test {old|new_txt|new_bin} model_file
second argument is the loaded format (DXF or Colobot .mod files)
requires ./tex folder (or symlink) with Colobot textures
viewer is controlled from keyboard - the bindings can be found in code
diff --git a/test/envs/opengl/light_test.cpp b/test/envs/opengl/light_test.cpp
index 0baf6d3..227ca2a 100644
--- a/test/envs/opengl/light_test.cpp
+++ b/test/envs/opengl/light_test.cpp
@@ -365,6 +365,9 @@ int SDL_MAIN_FUNC(int argc, char *argv[])
{
CLogger logger;
+ CSystemUtils* systemUtils = CSystemUtils::Create(); // platform-specific utils
+ systemUtils->Init();
+
PREV_TIME = GetSystemUtils()->CreateTimeStamp();
CURR_TIME = GetSystemUtils()->CreateTimeStamp();
diff --git a/test/envs/opengl/model_test.cpp b/test/envs/opengl/model_test.cpp
index 1dda69c..fa4042c 100644
--- a/test/envs/opengl/model_test.cpp
+++ b/test/envs/opengl/model_test.cpp
@@ -265,6 +265,9 @@ int SDL_MAIN_FUNC(int argc, char *argv[])
{
CLogger logger;
+ CSystemUtils* systemUtils = CSystemUtils::Create(); // platform-specific utils
+ systemUtils->Init();
+
PREV_TIME = GetSystemUtils()->CreateTimeStamp();
CURR_TIME = GetSystemUtils()->CreateTimeStamp();
@@ -273,7 +276,7 @@ int SDL_MAIN_FUNC(int argc, char *argv[])
if (argc != 3)
{
- std::cerr << "Usage: " << argv[0] << "{old|new_txt|new_bin} model_file" << std::endl;
+ std::cerr << "Usage: " << argv[0] << " {old|new_txt|new_bin} model_file" << std::endl;
return 1;
}
diff --git a/test/envs/opengl/transform_test.cpp b/test/envs/opengl/transform_test.cpp
index 1d5ccf1..58d8e9e 100644
--- a/test/envs/opengl/transform_test.cpp
+++ b/test/envs/opengl/transform_test.cpp
@@ -243,6 +243,9 @@ int SDL_MAIN_FUNC(int argc, char *argv[])
{
CLogger logger;
+ CSystemUtils* systemUtils = CSystemUtils::Create(); // platform-specific utils
+ systemUtils->Init();
+
PREV_TIME = GetSystemUtils()->CreateTimeStamp();
CURR_TIME = GetSystemUtils()->CreateTimeStamp();
diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt
index 1f5e1bc..38bffda 100644
--- a/test/unit/CMakeLists.txt
+++ b/test/unit/CMakeLists.txt
@@ -18,20 +18,12 @@ endif()
# Configure file
configure_file(${SRC_DIR}/common/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/common/config.h)
-# Platform-dependent implementation of system.h
-if(PLATFORM_WINDOWS)
- set(SYSTEM_CPP_MODULE "system_windows.cpp")
-elseif(PLATFORM_LINUX)
- set(SYSTEM_CPP_MODULE "system_linux.cpp")
-else()
- set(SYSTEM_CPP_MODULE "system_other.cpp")
-endif()
-
# Code sources
set(COLOBOT_SOURCES
${SRC_DIR}/app/app.cpp
${SRC_DIR}/app/system.cpp
${SRC_DIR}/app/${SYSTEM_CPP_MODULE}
+${SRC_DIR}/app/system_other.cpp
${SRC_DIR}/common/event.cpp
${SRC_DIR}/common/image.cpp
${SRC_DIR}/common/iman.cpp
diff --git a/test/unit/common/CMakeLists.txt b/test/unit/common/CMakeLists.txt
index aebf17a..cf37961 100644
--- a/test/unit/common/CMakeLists.txt
+++ b/test/unit/common/CMakeLists.txt
@@ -7,10 +7,15 @@ ${GTEST_INCLUDE_DIR}
add_executable(image_test ${SRC_DIR}/common/image.cpp image_test.cpp)
target_link_libraries(image_test ${SDL_LIBRARY} ${SDLIMAGE_LIBRARY} ${PNG_LIBRARIES})
+add_test(NAME image_test
+ COMMAND ${CMAKE_BINARY_DIR}/image_test ${CMAKE_SOURCE_DIR}/test/envs/opengl/tex1.png ${CMAKE_BINARY_DIR}/tex1_test.png)
file(COPY colobot.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-# add_executable(profile_test ${SRC_DIR}/common/profile.cpp ${SRC_DIR}/common/logger.cpp profile_test.cpp)
-# target_link_libraries(profile_test gtest ${Boost_LIBRARIES})
+add_executable(profile_test ${SRC_DIR}/common/profile.cpp ${SRC_DIR}/common/logger.cpp profile_test.cpp)
+set_target_properties(profile_test PROPERTIES COMPILE_DEFINITIONS "DEV_BUILD=1")
+target_link_libraries(profile_test gtest ${Boost_LIBRARIES})
-# add_test(profile_test ./profile_test)
+add_test(NAME profile_test
+ COMMAND ${CMAKE_BINARY_DIR}/profile_test
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
diff --git a/test/unit/ui/CMakeLists.txt b/test/unit/ui/CMakeLists.txt
index 97dd681..8086967 100644
--- a/test/unit/ui/CMakeLists.txt
+++ b/test/unit/ui/CMakeLists.txt
@@ -10,21 +10,18 @@ ${CLIPBOARD_INCLUDE_DIR}
# Platform-dependent implementation of CSystemUtils
if(PLATFORM_WINDOWS)
- set(SYSTEM_CPP_MODULE "system_windows.cpp")
elseif(PLATFORM_LINUX)
- set(SYSTEM_CPP_MODULE "system_linux.cpp")
set(ADDITIONAL_LIB "-lX11")
elseif(PLATFORM_MACOSX)
- set(SYSTEM_CPP_MODULE "system_other.cpp")
set(ADDITIONAL_LIB "${X11_X11_LIB}")
else()
- set(SYSTEM_CPP_MODULE "system_other.cpp")
set(ADDITIONAL_LIB "-lX11")
endif()
add_executable(edit_test
${SRC_DIR}/app/system.cpp
${SRC_DIR}/app/${SYSTEM_CPP_MODULE}
+${SRC_DIR}/app/system_other.cpp
${SRC_DIR}/common/event.cpp
${SRC_DIR}/common/logger.cpp
${SRC_DIR}/common/misc.cpp