aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-12-22 18:34:29 +0000
committerYann Herklotz <ymherklotz@gmail.com>2017-12-22 18:34:29 +0000
commit24253190c92c9d7ef669061670a3b7596f9ee190 (patch)
treef03d785e30a7783b5e0d5e7b669cd2997d5877ed /tests
parentb885965a6375f98d6bec63a43233461f9f42006d (diff)
downloadYAGE-24253190c92c9d7ef669061670a3b7596f9ee190.tar.gz
YAGE-24253190c92c9d7ef669061670a3b7596f9ee190.zip
Changing directories and adding input support
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt37
m---------tests/external/googletest0
-rw-r--r--tests/simplegame.cpp7
3 files changed, 41 insertions, 3 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644
index 00000000..613e0bdb
--- /dev/null
+++ b/tests/CMakeLists.txt
@@ -0,0 +1,37 @@
+# Initializing google test
+# prevents overriding the parent project's compiler/linter settings on windows
+set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
+set(BUILD_GTEST ON CACHE BOOL "" FORCE)
+set(BUILD_GMOCK OFF CACHE BOOL "" FORCE)
+
+# Add googletest directly to our build. This defines
+# the gtest and gtest_main targets.
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/googletest)
+
+add_executable(simplegame simplegame.cpp)
+target_link_libraries(simplegame yage)
+
+# enable tests
+enable_testing()
+set(SIMULATION_RUNS 1000)
+
+function(make_test test_name cycles)
+ add_executable(${test_name} ${test_name}.cpp)
+ target_link_libraries(${test_name}
+ gtest_main
+ yage)
+ add_test(NAME ${test_name} COMMAND ${test_name} --gtest_repeat=${cycles} --gtest_break_on_failure)
+endfunction(make_test)
+
+make_test(yagetest 1)
+make_test(matrixtest ${SIMULATION_RUNS})
+make_test(particlebodytest 100)
+make_test(windowtest ${SIMULATION_RUNS})
+make_test(spritesheettest ${SIMULATION_RUNS})
+make_test(vector3test ${SIMULATION_RUNS})
+make_test(vector4test ${SIMULATION_RUNS})
+make_test(logtest 1)
+make_test(threadtest 1)
+make_test(syncqueuetest 1)
+make_test(activetest 1)
+make_test(structtest ${SIMULATION_RUNS})
diff --git a/tests/external/googletest b/tests/external/googletest
new file mode 160000
+Subproject 5490beb0602eab560fa3969a4410e11d94bf12a
diff --git a/tests/simplegame.cpp b/tests/simplegame.cpp
index d4c7b266..04d63ec0 100644
--- a/tests/simplegame.cpp
+++ b/tests/simplegame.cpp
@@ -22,7 +22,8 @@ int main()
window.create("Simple Game", 800, 640);
SpriteBatch sp;
- program.defaultSetup();
+ program.compileShadersFromFile("resources/textureshader.vert", "resources/textureshader.frag");
+ program.linkShaders();
Texture fountain =
ResourceManager::getTexture("/home/yannherklotz/Github/YAGE/tests/"
@@ -43,13 +44,13 @@ int main()
GLint texture_location = program.getUniformLocation("texture_sampler");
glUniform1i(texture_location, 0);
- sp.draw({0.f, 0.f, 64.f, 64.f}, {0, 0, 1, 1}, fountain.id, Colour(), 0);
+ sp.draw({0.f, 0.f, 64.f, 64.f}, {0, 0, 1, 1}, fountain.id, Colour(255, 0, 255, 255), 0);
sp.render();
glBindTexture(GL_TEXTURE_2D, 0);
program.unuse();
- window.pollEvents();
window.swapBuffer();
+ window.pollEvents();
}
}