From 4432bcb93c4f72d8a47731f197249dc98576886a Mon Sep 17 00:00:00 2001 From: AdenKoperczak Date: Mon, 9 Dec 2024 14:12:18 -0500 Subject: [PATCH] Fixed existing tests in location_marker_part2 --- test/data | 2 +- .../scwx/qt/model/marker_model.test.cpp | 29 ++++++++++--------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/test/data b/test/data index 4b4d9c54..42783ea4 160000 --- a/test/data +++ b/test/data @@ -1 +1 @@ -Subproject commit 4b4d9c54b8218aa2297dbd457e3747091570f0d2 +Subproject commit 42783ea4f3b118b2b0f3266efb53f9b4384f069b diff --git a/test/source/scwx/qt/model/marker_model.test.cpp b/test/source/scwx/qt/model/marker_model.test.cpp index 700ffc6e..8846c9cd 100644 --- a/test/source/scwx/qt/model/marker_model.test.cpp +++ b/test/source/scwx/qt/model/marker_model.test.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -30,6 +31,9 @@ static std::mutex initializedMutex {}; static std::condition_variable initializedCond {}; static bool initialized; +static const boost::gil::rgba8_pixel_t defaultIconColor = + util::color::ToRgba8PixelT("#ffff0000"); + void CompareFiles(const std::string& file1, const std::string& file2) { std::ifstream ifs1 {file1}; @@ -49,8 +53,7 @@ void CopyFile(const std::string& from, const std::string& to) CompareFiles(from, to); } -typedef void TestFunction(std::shared_ptr manager, - MarkerModel& model); +using TestFunction = void (std::shared_ptr, MarkerModel &); void RunTest(const std::string& filename, TestFunction testFunction) { @@ -65,7 +68,7 @@ void RunTest(const std::string& filename, TestFunction testFunction) initialized = false; QObject::connect(manager.get(), &manager::MarkerManager::MarkersInitialized, - [](size_t count) + []() { std::unique_lock lock(initializedMutex); initialized = true; @@ -119,7 +122,7 @@ TEST(MarkerModelTest, AddRemove) RunTest(ONE_MARKERS_FILE, [](std::shared_ptr manager, MarkerModel&) - { manager->add_marker(types::MarkerInfo("Null", 0, 0)); }); + { manager->add_marker(types::MarkerInfo("Null", 0, 0, "images/location-marker", defaultIconColor)); }); RunTest( EMPTY_MARKERS_FILE, [](std::shared_ptr manager, MarkerModel& model) @@ -143,11 +146,11 @@ TEST(MarkerModelTest, AddFive) RunTest(FIVE_MARKERS_FILE, [](std::shared_ptr manager, MarkerModel&) { - manager->add_marker(types::MarkerInfo("Null", 0, 0)); - manager->add_marker(types::MarkerInfo("North", 90, 0)); - manager->add_marker(types::MarkerInfo("South", -90, 0)); - manager->add_marker(types::MarkerInfo("East", 0, 90)); - manager->add_marker(types::MarkerInfo("West", 0, -90)); + manager->add_marker(types::MarkerInfo("Null", 0, 0, "images/location-marker", defaultIconColor)); + manager->add_marker(types::MarkerInfo("North", 90, 0, "images/location-marker", defaultIconColor)); + manager->add_marker(types::MarkerInfo("South", -90, 0, "images/location-marker", defaultIconColor)); + manager->add_marker(types::MarkerInfo("East", 0, 90, "images/location-marker", defaultIconColor)); + manager->add_marker(types::MarkerInfo("West", 0, -90, "images/location-marker", defaultIconColor)); }); std::filesystem::remove(TEMP_MARKERS_FILE); @@ -161,10 +164,10 @@ TEST(MarkerModelTest, AddFour) RunTest(FIVE_MARKERS_FILE, [](std::shared_ptr manager, MarkerModel&) { - manager->add_marker(types::MarkerInfo("North", 90, 0)); - manager->add_marker(types::MarkerInfo("South", -90, 0)); - manager->add_marker(types::MarkerInfo("East", 0, 90)); - manager->add_marker(types::MarkerInfo("West", 0, -90)); + manager->add_marker(types::MarkerInfo("North", 90, 0, "images/location-marker", defaultIconColor)); + manager->add_marker(types::MarkerInfo("South", -90, 0, "images/location-marker", defaultIconColor)); + manager->add_marker(types::MarkerInfo("East", 0, 90, "images/location-marker", defaultIconColor)); + manager->add_marker(types::MarkerInfo("West", 0, -90, "images/location-marker", defaultIconColor)); }); std::filesystem::remove(TEMP_MARKERS_FILE);