Skip to content

Commit

Permalink
#34 store image clippings to build folder during tests (for later exa…
Browse files Browse the repository at this point in the history
…mination and manual comparison).
  • Loading branch information
starturtle committed Nov 6, 2020
1 parent d31e3fd commit 3f55aa4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions qtgui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ if(DOCTEST_INCLUDE_DIR)
configure_file(resources/image/${TEST_FILE3} ${TEST_IMAGE_DIR}/${TEST_FILE3} COPYONLY)
configure_file(resources/image/${TEST_FILE4} ${TEST_IMAGE_DIR}/${TEST_FILE4} COPYONLY)
configure_file(resources/image/${TEST_FILE5} ${TEST_IMAGE_DIR}/${TEST_FILE5} COPYONLY)
target_compile_definitions( test_source_image PRIVATE -DTEST_DIR_NAME="${CMAKE_CURRENT_BINARY_DIR}/${TEST_IMAGE_DIR}/")
target_compile_definitions( test_source_image PRIVATE -DTEST_FILE_NAME="${CMAKE_CURRENT_BINARY_DIR}/${TEST_IMAGE_DIR}/${TEST_FILE1}")
target_compile_definitions( test_source_image PRIVATE -DTEST_FILE_NAME_2="${CMAKE_CURRENT_BINARY_DIR}/${TEST_IMAGE_DIR}/${TEST_FILE2}")
target_compile_definitions( test_source_image PRIVATE -DTEST_FILE_NAME_3="${CMAKE_CURRENT_BINARY_DIR}/${TEST_IMAGE_DIR}/${TEST_FILE3}")
Expand Down
6 changes: 6 additions & 0 deletions qtgui/SourceImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ unsigned compareQRgb(const QRgb& value1, const QRgb& value2, uchar maxDifference

struct RangeSelectionTestSet
{
std::string name;
QPoint topLeft;
QPoint bottomRight;
QPoint topLeftOriginal;
Expand Down Expand Up @@ -527,16 +528,19 @@ TEST_CASE("test mouse based range selection")

std::vector<RangeSelectionTestSet> movements{
{
"wibbel_topleft.jpg",
{10, 10},
{100, 100},
{23, 23},
{209, 209},
},{
"wibbel_middle.jpg",
{150, 150},
{300, 300},
{347, 347},
{349, 349},
},{
"wibbel_bottomright.jpg",
{250, 250},
{350, 350},
{579, 579},
Expand All @@ -554,6 +558,8 @@ TEST_CASE("test mouse based range selection")
// this rectangle, if resized to match the overall image size of 925x925, scales to a 441x441 rectangle starting at pixel 23x23.
fileSizeCheck(testImage, parameters.toClippingString(), parameters.sizeScaled());
compareSourceImageData(testImage, tester, parameters);
QString outPath(std::string(TEST_DIR_NAME + parameters.name).c_str());
testImage.data().save(outPath);
}
}

Expand Down

0 comments on commit 3f55aa4

Please sign in to comment.