Skip to content

Commit

Permalink
Increase red tolerance for let's go kill icon & add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NympheaR authored and Gin890 committed Oct 18, 2023
1 parent 43dd2a0 commit 8497523
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ bool LetsGoKillDetector::detect(const ImageViewRGB32& screen) const{
std::vector<PackedBinaryMatrix> matrices = compress_rgb32_to_binary_range(
region,
{
{0xff802020, 0xffff7f7f},
{0xffc02020, 0xffff7f7f},
{0xff801e1e, 0xffff7f7f},
{0xffb31e1e, 0xffff7f7f},
}
);
// size_t c = 0;
Expand Down
10 changes: 10 additions & 0 deletions SerialPrograms/Source/Tests/PokemonSV_Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "PokemonSV/Inference/Picnics/PokemonSV_SandwichHandDetector.h"
#include "PokemonSV/Inference/Picnics/PokemonSV_SandwichIngredientDetector.h"
#include "PokemonSV/Inference/Picnics/PokemonSV_SandwichPlateDetector.h"
#include "PokemonSV/Inference/Overworld/PokemonSV_LetsGoKillDetector.h"
#include "PokemonSV/Inference/Overworld/PokemonSV_OverworldDetector.h"
#include "PokemonSV/Inference/Dialogs/PokemonSV_DialogDetector.h"
#include "PokemonSV/Inference/PokemonSV_ESPEmotionDetector.h"
Expand Down Expand Up @@ -533,4 +534,13 @@ int test_pokemonSV_SandwichPlateDetector(const ImageViewRGB32& image, const std:
return 0;
}

int test_pokemonSV_RecentlyBattledDetector(const ImageViewRGB32& image, bool target){
LetsGoKillDetector detector(COLOR_RED, {0.23, 0.23, 0.04, 0.20});

const bool result = detector.detect(image);
TEST_RESULT_EQUAL(result, target);

return 0;
}

}
2 changes: 2 additions & 0 deletions SerialPrograms/Source/Tests/PokemonSV_Tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ int test_pokemonSV_MapFlyMenuDetector(const ImageViewRGB32& image, bool target);

int test_pokemonSV_SandwichPlateDetector(const ImageViewRGB32& image, const std::vector<std::string>& words);

int test_pokemonSV_RecentlyBattledDetector(const ImageViewRGB32& image, bool target);

}

#endif
3 changes: 2 additions & 1 deletion SerialPrograms/Source/Tests/TestMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ const std::map<std::string, TestFunction> TEST_MAP = {
{"PokemonSV_MapPokeCenterIconDetector", std::bind(image_int_detector_helper, test_pokemonSV_MapPokeCenterIconDetector, _1)},
{"PokemonSV_ESPPressedEmotionDetector", std::bind(image_bool_detector_helper, test_pokemonSV_ESPPressedEmotionDetector, _1)},
{"PokemonSV_MapFlyMenuDetector", std::bind(image_bool_detector_helper, test_pokemonSV_MapFlyMenuDetector, _1)},
{"PokemonSV_SandwichPlateDetector", std::bind(image_words_detector_helper, test_pokemonSV_SandwichPlateDetector, _1)}
{"PokemonSV_SandwichPlateDetector", std::bind(image_words_detector_helper, test_pokemonSV_SandwichPlateDetector, _1)},
{"PokemonSV_RecentlyBattledDetector", std::bind(image_bool_detector_helper, test_pokemonSV_RecentlyBattledDetector, _1)}
};

TestFunction find_test_function(const std::string& test_space, const std::string& test_name){
Expand Down

0 comments on commit 8497523

Please sign in to comment.