Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
#include "CommonFramework/ImageTypes/ImageRGB32.h"
#include "CommonFramework/ImageTools/ImageStats.h"
#include "CommonFramework/VideoPipeline/VideoFeed.h"
#include "Common/Cpp/TestRunners/UnitTestDatabase.h"
#include "CommonTools/Images/ImageManip.h"
#include "CommonTools/Images/ImageFilter.h"
#include "CommonTools/Images/SolidColorTest.h"
#include "CommonTools/Async/InferenceRoutines.h"
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
#include "Tests/ImageUnitTest.h"
#include "VideoGames/PokemonSwSh/Inference/PokemonSwSh_SelectionArrowFinder.h"
#include "VideoGames/PokemonSwSh/Inference/PokemonSwSh_DialogBoxDetector.h"
#include "VideoGames/PokemonSwSh/Inference/PokemonSwSh_YCommDetector.h"
Expand Down Expand Up @@ -88,7 +90,11 @@ std::shared_ptr<const ImageRGB32> enter_lobby(
// dialog_detector.make_overlays(boxes);

// OverlayBoxScope ore_box(stream.overlay(), {0.900, 0.015, 0.020, 0.040});
OverlayBoxScope ore_box(stream.overlay(), {0.930, 0.050, 0.065, 0.010});
// The top of the ore bar sits just below the "xNNN" ore counter. Start the box 2 px below the
// counter: on some capture cards the block-compression ringing of the digits bleeds into the
// first two rows, pushing the stddev sum right up against the is_solid limit so the prompt
// is missed (and then "Boss Slot" silently falls back to Slot 1, see issue #1925).
OverlayBoxScope ore_box(stream.overlay(), {0.930, 0.052, 0.065, 0.008});
OverlayBoxScope ore_quantity(stream.overlay(), {0.945, 0.010, 0.0525, 0.050});

size_t arrow_count = 0;
Expand Down Expand Up @@ -222,6 +228,42 @@ std::shared_ptr<const ImageRGB32> enter_lobby(




// The ore-payment prompt check of enter_lobby(): the bar behind the "pay N ore?" dialog is a
// solid warm color. Regression test for #1925: on captures where the "xNNN" ore counter above
// the bar causes block-compression ringing, the check used to sit right at the is_solid stddev
// limit, so the prompt was missed and "Boss Slot" silently fell back to Slot 1.
class Test_MaxLairEnterLobbyOrePrompt : public ImageUnitTest{
public:
Test_MaxLairEnterLobbyOrePrompt(const std::string& image)
: ImageUnitTest("PokemonSwSh::MaxLairEnterLobbyOrePrompt - " + image, {image})
, m_check(0.930, 0.052, 0.065, 0.008, 0.594724, 0.405276, 0.)
{}

virtual UnitTestResult run_on_images(
Logger& logger, CancellableScope& scope,
const std::vector<ImageRGB32>& images
) const override{
const ImageRGB32& image = images[0];
bool detected = m_check.check(image);
if (detected){
return UnitTestResult(true);
}
return UnitTestResult(UnitTestResult::FAILED, m_check.debug_string(image));
}

private:
ImageSolidCheck m_check;
};




void add_tests_MaxLairEnterLobbyOrePrompt(UnitTestDatabase& database){
database.add<Test_MaxLairEnterLobbyOrePrompt>(
"PokemonSwSh/MaxLair_EnterLobbyOrePrompt/MiraBox_macOS_Japanese_OrePaymentPrompt.png"
);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "CommonFramework/Tools/VideoStream.h"
#include "NintendoSwitch/Controllers/Procon/NintendoSwitch_ProController.h"
#include "VideoGames/PokemonSwSh/MaxLair/Framework/PokemonSwSh_MaxLair_StateMachine.h"
#include "Common/Cpp/TestRunners/UnitTest.h"

namespace PokemonAutomation{
namespace NintendoSwitch{
Expand All @@ -28,6 +29,10 @@ std::shared_ptr<const ImageRGB32> enter_lobby(



void add_tests_MaxLairEnterLobbyOrePrompt(UnitTestDatabase& database);



}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "VideoGames/PokemonSwSh/Inference/PokemonSwSh_SelectionArrowFinder.h"
#include "VideoGames/PokemonSwSh/MaxLair/Framework/PokemonSwSh_MaxLair_State_Tests.h"
#include "VideoGames/PokemonSwSh/MaxLair/Inference/PokemonSwSh_MaxLair_Detect_BattleMenu.h"
#include "VideoGames/PokemonSwSh/MaxLair/Program/PokemonSwSh_MaxLair_Run_EnterLobby.h"
#include "PokemonSwSh_Tests.h"

namespace PokemonAutomation{
Expand All @@ -31,6 +32,7 @@ void add_tests(UnitTestDatabase& database){
NintendoSwitch::PokemonSwSh::add_tests_YCommDetector(database);
NintendoSwitch::PokemonSwSh::add_tests_SelectionArrowFinder(database);
NintendoSwitch::PokemonSwSh::MaxLairInternal::add_tests_MaxLairBattleMenuDetector(database);
NintendoSwitch::PokemonSwSh::MaxLairInternal::add_tests_MaxLairEnterLobbyOrePrompt(database);
NintendoSwitch::PokemonSwSh::MaxLairInternal::add_tests_MaxLairBossState(database);
}

Expand Down
Loading