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 @@ -7,6 +7,7 @@
#include <map>
#include "Common/Cpp/Concurrency/SpinLock.h"
#include "Common/Cpp/Concurrency/AsyncTask.h"
#include "Common/Cpp/TestRunners/UnitTestDatabase.h"
#include "CommonFramework/Exceptions/OperationFailedExceptionWithScreenshot.h"
#include "CommonFramework/ImageTypes/ImageViewRGB32.h"
#include "CommonFramework/ImageTypes/ImageRGB32.h"
Expand All @@ -16,6 +17,8 @@
#include "CommonTools/Images/ImageFilter.h"
#include "CommonTools/OCR/OCR_NumberReader.h"
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
#include "Tests/ImageUnitTest.h"
#include "Tests/TestUtils.h"
#include "PokemonSV_ItemPrinterJobsDetector.h"

namespace PokemonAutomation{
Expand Down Expand Up @@ -147,6 +150,48 @@ void ItemPrinterJobsDetector::set_print_jobs(



class Test_ItemPrinterJobsDetector : public ImageUnitTest{
public:
Test_ItemPrinterJobsDetector(
const std::string& image,
int expected_jobs
)
: ImageUnitTest("PokemonSV::ItemPrinterJobsDetector - " + image, {image})
, m_expected_jobs(expected_jobs)
{
// Plus the PaddleOCR (ONNX) recognition session and its working set.
m_memory += PADDLE_OCR_SINGLE_LINE_MEMORY_ESTIMATE;
}

virtual UnitTestResult run_on_images(
Logger& logger, CancellableScope& scope,
const std::vector<ImageRGB32>& images
) const override{
const ImageRGB32& image = images[0];

ItemPrinterJobsDetector detector(COLOR_RED);
uint8_t jobs = detector.detect_jobs(logger, image);

TEST_RESULT_EQUAL_STR((int)jobs, m_expected_jobs);

return true;
};

private:
int m_expected_jobs;
};



void add_tests_ItemPrinterJobsDetector(UnitTestDatabase& database){
database.add<Test_ItemPrinterJobsDetector>(
"PokemonSV/ItemPrinterJobsDetector/Japanese_Jobs_1.png",
1
);
}






Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#define PokemonAutomation_PokemonSV_ItemPrinterJobsDetector_H

#include "Common/Cpp/Color.h"
#include "Common/Cpp/TestRunners/UnitTest.h"
#include "CommonFramework/ImageTools/ImageBoxes.h"
#include "CommonFramework/Tools/VideoStream.h"
#include "CommonTools/VisualDetector.h"
Expand Down Expand Up @@ -46,6 +47,10 @@ class ItemPrinterJobsDetector{



void add_tests_ItemPrinterJobsDetector(UnitTestDatabase& database);



}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "Inference/Overworld/PokemonSV_LetsGoKillDetector.h"
#include "Inference/Picnics/PokemonSV_SandwichRecipeDetector.h"
#include "Inference/Picnics/PokemonSV_SandwichHandDetector.h"
#include "Inference/ItemPrinter/PokemonSV_ItemPrinterJobsDetector.h"
#include "Programs/Farming/PokemonSV_BBQTests.h"
#include "PokemonSV_Tests.h"

Expand Down Expand Up @@ -53,6 +54,7 @@ void add_tests(UnitTestDatabase& database){
add_tests_TeraCardDetector(database);
add_tests_TeraSilhouetteReader(database);
add_tests_TeraTypeReader(database);
add_tests_ItemPrinterJobsDetector(database);
add_tests_NormalBattleMenus(database);
add_tests_LetsGoKillDetector(database);
add_tests_BBQ(database);
Expand Down
Loading