|
14 | 14 | #include "NintendoSwitch/NintendoSwitch_ConsoleHandle.h" |
15 | 15 | #include "PokemonLZA/Inference/PokemonLZA_DialogDetector.h" |
16 | 16 | #include "PokemonLZA/Inference/PokemonLZA_ButtonDetector.h" |
| 17 | +#include "PokemonLZA/Inference/PokemonLZA_SelectionArrowDetector.h" |
17 | 18 | #include "PokemonLZA/Inference/PokemonLZA_MainMenuDetector.h" |
18 | 19 | #include "PokemonLZA/Inference/Boxes/PokemonLZA_BoxDetection.h" |
19 | 20 | #include "PokemonLZA/Inference/Boxes/PokemonLZA_BoxInfoDetector.h" |
@@ -122,6 +123,42 @@ int test_pokemonLZA_MainMenuDetector(const ImageViewRGB32& image, bool target){ |
122 | 123 | return 0; |
123 | 124 | } |
124 | 125 |
|
| 126 | +int test_pokemonLZA_SelectionArrowDetector(const ImageViewRGB32& image, const std::vector<std::string>& words){ |
| 127 | + // two words: <situation> <True/False> |
| 128 | + if (words.size() < 2){ |
| 129 | + cerr << "Error: not enough number of words in the filename. Found only " << words.size() << "." << endl; |
| 130 | + return 1; |
| 131 | + } |
| 132 | + |
| 133 | + // Parse situation from second to last word |
| 134 | + const std::string& situation_str = words[words.size() - 2]; |
| 135 | + SelectionArrowType arrow_type; |
| 136 | + ImageFloatBox search_box; |
| 137 | + |
| 138 | + if (situation_str == "Fossil"){ |
| 139 | + arrow_type = SelectionArrowType::RIGHT; |
| 140 | + search_box = ImageFloatBox(0.6300, 0.4440, 0.2260, 0.3190); |
| 141 | + }else{ |
| 142 | + cerr << "Error: unknown situation '" << situation_str << "' in filename." << endl; |
| 143 | + return 1; |
| 144 | + } |
| 145 | + |
| 146 | + // Parse True/False from last word |
| 147 | + bool target = false; |
| 148 | + if (parse_bool(words[words.size() - 1], target) == false){ |
| 149 | + cerr << "Error: last word in filename should be True or False." << endl; |
| 150 | + return 1; |
| 151 | + } |
| 152 | + |
| 153 | + // Run detector with the specified search box and arrow type |
| 154 | + auto overlay = DummyVideoOverlay(); |
| 155 | + SelectionArrowDetector detector(COLOR_RED, &overlay, arrow_type, search_box); |
| 156 | + bool result = detector.detect(image); |
| 157 | + |
| 158 | + TEST_RESULT_EQUAL(result, target); |
| 159 | + return 0; |
| 160 | +} |
| 161 | + |
125 | 162 | int test_pokemonLZA_BoxCellInfoDetector(const ImageViewRGB32& image, const std::vector<std::string>& words){ |
126 | 163 | // Expected filename format: <...>_<row>_<col>_<status>.png |
127 | 164 | // Where status is one of: Empty, Shiny, Alpha, ShinyAlpha |
|
0 commit comments