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 @@ -4,6 +4,7 @@
*
*/

#include "CommonFramework/Globals.h"
#include "CommonFramework/ImageTools/ImageStats.h"
#include "CommonTools/Images/SolidColorTest.h"
#include "CommonFramework/VideoPipeline/VideoOverlayScopes.h"
Expand Down Expand Up @@ -72,4 +73,29 @@ bool BlackBorderDetector::detect(const ImageViewRGB32& screen){
}


class Test_BlackBorderDetector : public UnitTest{
public:
Test_BlackBorderDetector(const std::string& image, bool expected)
: UnitTest("CommonFramework::BlackBorderDetector - " + image)
, m_image(UNIT_TEST_RESOURCE_PATH() + image)
, m_expected(expected)
{}

virtual UnitTestResult run(Logger& logger, CancellableScope& scope) const override{
BlackBorderDetector detector;
ImageRGB32 image(m_image);
return detector.detect(image) == m_expected;
}

private:
std::string m_image;
bool m_expected;
};


void add_tests_BlackBorderDetector(UnitTestDatabase& database){
database.add<Test_BlackBorderDetector>("CommonFramework/BlackBorderDetector/Dark_SV_Crystal_False.png", false);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#ifndef PokemonAutomation_CommonTools_BlackBorderDetector_H
#define PokemonAutomation_CommonTools_BlackBorderDetector_H

#include "Common/Cpp/TestRunners/UnitTestDatabase.h"
#include "CommonFramework/ImageTools/ImageBoxes.h"
#include "CommonTools/VisualDetector.h"

Expand All @@ -29,6 +30,9 @@ class BlackBorderDetector : public StaticScreenDetector{
};


void add_tests_BlackBorderDetector(UnitTestDatabase& database);



}
#endif
12 changes: 12 additions & 0 deletions SerialPrograms/Source/ComputerPrograms/UnitTestRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@
#include "CommonFramework/Globals.h"
#include "CommonFramework/ProgramStats/StatsTracking.h"
#include "CommonFramework/Tools/GlobalThreadPools.h"
#include "CommonTools/VisualDetectors/BlackBorderDetector.h"
#include "NintendoSwitch/Inference/NintendoSwitch_CheckOnlineDetector.h"
#include "NintendoSwitch/Inference/NintendoSwitch_FailedToConnectDetector.h"
#include "NintendoSwitch/Inference/NintendoSwitch_UpdatePopupDetector.h"
#include "UnitTestRunner.h"

#include "CommonTools/OCR/OCR_Tests.h"
#include "Kernels/Kernels_Tests.h"
#include "PokemonFRLG/PokemonFRLG_Tests.h"
#include "PokemonHome/PokemonHome_Tests.h"
#include "PokemonSwSh/PokemonSwSh_Tests.h"
#include "PokemonLA/PokemonLA_Tests.h"
Expand All @@ -30,7 +36,13 @@ namespace ComputerPrograms{
UnitTestDatabase make_UNIT_TESTS_ALL(){
UnitTestDatabase ret;

add_tests_BlackBorderDetector(ret);
OCR::add_tests(ret);
Kernels::add_tests(ret);
NintendoSwitch::add_tests_CheckOnlineDetector(ret);
NintendoSwitch::add_tests_FailedToConnectDetector(ret);
NintendoSwitch::add_tests_UpdatePopupDetector(ret);
NintendoSwitch::PokemonFRLG::add_tests(ret);
NintendoSwitch::PokemonHome::add_tests(ret);
NintendoSwitch::PokemonSwSh::add_tests(ret);
NintendoSwitch::PokemonLA::add_tests(ret);
Expand Down
Loading
Loading