Skip to content

Commit 67a0212

Browse files
author
Gin
committed
Add test for mac neon failure
1 parent b52b096 commit 67a0212

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

SerialPrograms/Source/PokemonSwSh/Inference/PokemonSwSh_SelectionArrowFinder.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,18 @@ bool is_selection_arrow(const ImageViewRGB32& image, const WaterfillObject& obje
8383
}
8484
std::vector<ImagePixelBox> find_selection_arrows(const ImageViewRGB32& image, size_t min_area){
8585
if (PreloadSettings::debug().IMAGE_TEMPLATE_MATCHING){
86-
std::cout << "Match SwSh selection arrow by waterfill, size range (" << min_area << ", SIZE_MAX)" << std::endl;
86+
std::cout << "Match SwSh selection arrow by waterfill, size range (" << min_area << ", SIZE_MAX) "
87+
<< "input image size " << image.width() << " x " << image.height() << std::endl;
8788
}
8889
PackedBinaryMatrix matrix = compress_rgb32_to_binary_max(image, 63, 63, 63);
8990
auto session = make_WaterfillSession(matrix);
9091
auto finder = session->make_iterator(min_area);
9192
std::vector<ImagePixelBox> ret;
9293
WaterfillObject object;
9394
while (finder->find_next(object, true)){
94-
// cout << object.min_x << "-" << object.max_x << ", " << object.min_y << "-" << object.max_y << endl;
95+
if (PreloadSettings::debug().IMAGE_TEMPLATE_MATCHING){
96+
std::cout << "Found object: " << object.min_x << "-" << object.max_x << ", " << object.min_y << "-" << object.max_y << std::endl;
97+
}
9598
if (is_selection_arrow(image, object)){
9699
ret.emplace_back(object);
97100
}

SerialPrograms/Source/Tests/PokemonSwSh_Tests.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ using std::endl;
3030

3131
namespace PokemonAutomation{
3232

33+
namespace NintendoSwitch{
34+
namespace PokemonSwSh{
35+
std::vector<ImagePixelBox> find_selection_arrows(const ImageViewRGB32& image, size_t min_area);
36+
}
37+
}
38+
3339
using namespace NintendoSwitch::PokemonSwSh;
3440

3541
int test_pokemonSwSh_YCommMenuDetector(const ImageViewRGB32& image, bool target){
@@ -125,4 +131,13 @@ int test_pokemonSwSh_BoxGenderDetector(const ImageViewRGB32& image, int target){
125131
return 0;
126132
}
127133

134+
int test_pokemonSwSh_SelectionArrowFinder(const ImageViewRGB32& image, int target){
135+
std::vector<ImagePixelBox> boxes = find_selection_arrows(image, 10);
136+
for(const auto& box : boxes){
137+
std::cout << "Found box: " << box.min_x << " " << box.max_x << " " << box.min_y << " " << box.max_y << std::endl;
138+
}
139+
TEST_RESULT_EQUAL(boxes.size(), (size_t)target);
140+
return 0;
141+
}
142+
128143
}

SerialPrograms/Source/Tests/PokemonSwSh_Tests.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ int test_pokemonSwSh_BoxShinySymbolDetector(const ImageViewRGB32& image, bool ta
3838

3939
int test_pokemonSwSh_BoxGenderDetector(const ImageViewRGB32& image, int target);
4040

41+
int test_pokemonSwSh_SelectionArrowFinder(const ImageViewRGB32& image, int target);
42+
4143
}
4244

4345
#endif

SerialPrograms/Source/Tests/TestMap.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ const std::map<std::string, TestFunction> TEST_MAP = {
240240
{"PokemonSwSh_BlackDialogBoxDetector", std::bind(image_bool_detector_helper, test_pokemonSwSh_BlackDialogBoxDetector, _1)},
241241
{"PokemonSwSh_BoxShinySymbolDetector", std::bind(image_bool_detector_helper, test_pokemonSwSh_BoxShinySymbolDetector, _1)},
242242
{"PokemonSwSh_BoxGenderDetector", std::bind(image_int_detector_helper, test_pokemonSwSh_BoxGenderDetector, _1)},
243+
{"PokemonSwSh_SelectionArrowFinder", std::bind(image_int_detector_helper, test_pokemonSwSh_SelectionArrowFinder, _1)},
243244
{"PokemonLA_BattleMenuDetector", std::bind(image_bool_detector_helper, test_pokemonLA_BattleMenuDetector, _1)},
244245
{"PokemonLA_BattlePokemonSwitchDetector", std::bind(image_bool_detector_helper, test_pokemonLA_BattlePokemonSwitchDetector, _1)},
245246
{"PokemonLA_TransparentDialogueDetector", std::bind(image_bool_detector_helper, test_pokemonLA_TransparentDialogueDetector, _1)},

0 commit comments

Comments
 (0)