shithub: tinygl

Download patch

ref: 814691362a4dd3912cc0ad5d2599cd1576d3679a
parent: 700e888f729a6aa8d2479d42ec5f4112afe744f6
parent: d318c8d186417fc1e4df0a17c46961ad01b2f36a
author: DMHSW <6974902+gek169@users.noreply.github.com>
date: Tue Jul 20 11:21:59 EDT 2021

Merge pull request #10 from starseeker/main

Fix Raw_Demos build, add test target to check gears render

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,6 +41,8 @@
 # Examples
 if(TINYGL_BUILD_EXAMPLES)
 
+  enable_testing()
+
   # These deliberately do not depend on SDL.  TODO - these could be used to
   # drive a "make test" system to check the correct functioning of the library
   # after compilation...
--- a/Raw_Demos/CMakeLists.txt
+++ b/Raw_Demos/CMakeLists.txt
@@ -7,7 +7,7 @@
 if(TINYGL_LIB)
 
   set(raw_names gears t2i bigfont)
-  foreach(DEMO ${demo_names})
+  foreach(DEMO ${raw_names})
     set(DEMO_NAME "raw_${DEMO}")
     add_executable(${DEMO_NAME} ${DEMO}.c)
     target_link_libraries(${DEMO_NAME} ${TINYGL_LIB} ${M_LIBRARY})
@@ -17,6 +17,11 @@
   # Copy utility files to build dir
   configure_file(asciifractal.sh ${CMAKE_CURRENT_BINARY_DIR}/asciifractal.sh)
   configure_file(char.txt ${CMAKE_CURRENT_BINARY_DIR}/char.txt)
+
+  # Check that the gears image is rendered
+  add_test(NAME render_gears COMMAND raw_gears)
+  add_test(NAME diff_gears COMMAND ${CMAKE_COMMAND} -E compare_files ${CMAKE_CURRENT_SOURCE_DIR}/gears_orig.png ${CMAKE_CURRENT_BINARY_DIR}/render.png)
+  set_tests_properties(diff_gears PROPERTIES DEPENDS render_gears)
 
 endif(TINYGL_LIB)
 
binary files /dev/null b/Raw_Demos/gears_orig.png differ