-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
160 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule TestingSet
added at
043fb8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
file( | ||
GLOB_RECURSE | ||
testing_src | ||
*.cpp | ||
*.h | ||
*.hpp) | ||
|
||
add_executable(testing ${testing_src}) | ||
|
||
target_link_libraries(testing MaaFramework) | ||
|
||
add_dependencies(testing MaaFramework) | ||
|
||
install(TARGETS testing RUNTIME DESTINATION bin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <filesystem> | ||
|
||
#include "module/PipelineSmoking.h" | ||
|
||
#include "MaaFramework/MaaAPI.h" | ||
|
||
int main([[maybe_unused]] int argc, char** argv) | ||
{ | ||
auto cur_dir = std::filesystem::path(argv[0]).parent_path(); | ||
|
||
std::string logging_dir = (cur_dir / "debug").string(); | ||
MaaSetGlobalOption(MaaGlobalOption_Logging, (void*)logging_dir.c_str(), logging_dir.size()); | ||
bool on = true; | ||
MaaSetGlobalOption(MaaGlobalOption_DebugMode, &on, sizeof(on)); | ||
|
||
bool ret = pipeline_smoking(cur_dir); | ||
|
||
return ret ? 0 : -1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#include "PipelineSmoking.h" | ||
|
||
#include <iostream> | ||
|
||
#include <meojson/json.hpp> | ||
|
||
#include "MaaFramework/MaaAPI.h" | ||
|
||
bool pipeline_smoking(const std::filesystem::path& cur_dir) | ||
{ | ||
auto testing_path = cur_dir.parent_path() / "test" / "PipelineSmoking"; | ||
auto result_path = cur_dir / "debug"; | ||
json::value debug_config = { { "device_info", json::object { | ||
{ "uuid", testing_path.string() }, | ||
{ "screen_width", 1280 }, | ||
{ "screen_height", 720 }, | ||
{ "orientation", 0 }, | ||
} } }; | ||
auto config = debug_config.dumps(4); | ||
|
||
auto controller_handle = | ||
MaaDebuggingControllerCreate(testing_path.string().c_str(), result_path.string().c_str(), | ||
MaaDebuggingControllerType_Screencap_ReadIndex, config.c_str(), nullptr, nullptr); | ||
|
||
auto ctrl_id = MaaControllerPostConnection(controller_handle); | ||
|
||
auto resource_handle = MaaResourceCreate(nullptr, nullptr); | ||
auto resource_dir = cur_dir.parent_path() / "test" / "PipelineSmoking" / "resource"; | ||
auto res_id = MaaResourcePostPath(resource_handle, resource_dir.string().c_str()); | ||
|
||
MaaControllerWait(controller_handle, ctrl_id); | ||
MaaResourceWait(resource_handle, res_id); | ||
|
||
auto maa_handle = MaaCreate(nullptr, nullptr); | ||
MaaBindResource(maa_handle, resource_handle); | ||
MaaBindController(maa_handle, controller_handle); | ||
|
||
auto destroy = [&]() { | ||
MaaDestroy(maa_handle); | ||
MaaResourceDestroy(resource_handle); | ||
MaaControllerDestroy(controller_handle); | ||
}; | ||
|
||
if (!MaaInited(maa_handle)) { | ||
std::cout << __FUNCTION__ << " | Failed to init" << std::endl; | ||
|
||
destroy(); | ||
return false; | ||
} | ||
|
||
auto task_id = MaaPostTask(maa_handle, "Wilderness", MaaTaskParam_Empty); | ||
MaaWaitTask(maa_handle, task_id); | ||
|
||
destroy(); | ||
|
||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#include <filesystem> | ||
|
||
bool pipeline_smoking(const std::filesystem::path& cur_dir); |