From 3806efe6fce451a30b9cb7ef00f9fdaa14063e39 Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Fri, 6 Sep 2013 02:02:02 -0400 Subject: [PATCH] Add some more hacky includes to be able to output debug images from our tests. --- PVRTCEncoder/test/CMakeLists.txt | 3 +++ PVRTCEncoder/test/DecompTestPVR.cpp | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/PVRTCEncoder/test/CMakeLists.txt b/PVRTCEncoder/test/CMakeLists.txt index 236aa2a..c9aa3fb 100644 --- a/PVRTCEncoder/test/CMakeLists.txt +++ b/PVRTCEncoder/test/CMakeLists.txt @@ -88,6 +88,7 @@ IF(PVRTEXLIB_FOUND) # Make sure to include the PVR library headers... INCLUDE_DIRECTORIES( ${PVRTEXLIB_INCLUDE_DIRS} ) + INCLUDE_DIRECTORIES( ${FasTC_SOURCE_DIR}/Core/include ) # The cpp file to compile for the test ADD_EXECUTABLE(${TEST_NAME} DecompTestPVR.cpp) @@ -96,6 +97,8 @@ IF(PVRTEXLIB_FOUND) TARGET_LINK_LIBRARIES(${TEST_NAME} PVRTCEncoder) TARGET_LINK_LIBRARIES(${TEST_NAME} gtest_main) TARGET_LINK_LIBRARIES(${TEST_NAME} ${PVRTEXLIB_LIBRARIES} ) + TARGET_LINK_LIBRARIES(${TEST_NAME} FasTCIO) + TARGET_LINK_LIBRARIES(${TEST_NAME} FasTCCore) ADD_TEST(${TEST_NAME} ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR} diff --git a/PVRTCEncoder/test/DecompTestPVR.cpp b/PVRTCEncoder/test/DecompTestPVR.cpp index 0e0c21d..eabbaca 100644 --- a/PVRTCEncoder/test/DecompTestPVR.cpp +++ b/PVRTCEncoder/test/DecompTestPVR.cpp @@ -60,6 +60,13 @@ #include "TestUtils.h" +// #define OUTPUT_DEBUG_IMAGE + +#ifdef OUTPUT_DEBUG_IMAGE +# include "Core/include/Image.h" +# include "IO/include/ImageFile.h" +#endif // OUTPUT_DEBUG_IMAGE + class ImageTester { public: ImageTester(const char *filename) { @@ -89,6 +96,13 @@ public: EXPECT_EQ(PixelPrinter(libPixels[i]), PixelPrinter(outPixels[i])); } +#ifdef OUTPUT_DEBUG_IMAGE + char dbgfname[256]; + sprintf(dbgfname, "Debug%s.png", filename); + ::ImageFile imgFile(dbgfname, eFileFormat_PNG, ::Image(w, h, outPixels)); + imgFile.Write(); +#endif // OUTPUT_DEBUG_IMAGE + delete outPixels; } }; @@ -104,3 +118,4 @@ TEST(Decompressor, DecompressWhite) { TEST(Decompressor, DecompressGray) { ImageTester("gray.pvr"); } +