mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-27 21:45:16 +01:00
refactor: rename the import methods and the module variables (Sonar S1669) (#363)
import and module are contextual keywords of C++20 modules. The text loaders of the scene nodes (shape_node, lines_node, road_node, junction_node, roadpoint_node, sweep_node) become import_from(), the WASM module of the screen host's cache entry and of load() becomes wasm_module, and the path of the written test module becomes module_path. Renames only.
This commit is contained in:
@@ -285,16 +285,16 @@ constexpr std::array<std::uint8_t, 273> flood_module{
|
||||
TEST_CASE("wasm screens: a cab screen draws from its input and sends commands to its vehicle") {
|
||||
sent_commands().clear();
|
||||
script_folder const folder{"wasm_paint"};
|
||||
auto const module{folder.write("paint.wasm", paint_module)};
|
||||
auto const module_path{folder.write("paint.wasm", paint_module)};
|
||||
script_screen_queue queue;
|
||||
REQUIRE(queue.init());
|
||||
REQUIRE(queue.runs(script_language::wasm));
|
||||
|
||||
recording_texture texture;
|
||||
auto const screen{queue.acquire(request(script_language::wasm, module, "cab", &texture))};
|
||||
auto const screen{queue.acquire(request(script_language::wasm, module_path, "cab", &texture))};
|
||||
REQUIRE(screen != nullptr);
|
||||
// the same key, the same screen
|
||||
CHECK(queue.acquire(request(script_language::wasm, module, "cab", &texture)) == screen);
|
||||
CHECK(queue.acquire(request(script_language::wasm, module_path, "cab", &texture)) == screen);
|
||||
|
||||
refresh(queue, screen, speed(5.0), 42);
|
||||
REQUIRE(run_until(queue, [&texture] { return texture.uploads > 0 && false == sent_commands().empty(); }));
|
||||
@@ -321,13 +321,13 @@ TEST_CASE("wasm screens: a cab screen draws from its input and sends commands to
|
||||
TEST_CASE("wasm screens: the image goes up again when the texture is made anew, and waits while it isn't there") {
|
||||
sent_commands().clear();
|
||||
script_folder const folder{"wasm_reupload"};
|
||||
auto const module{folder.write("paint.wasm", paint_module)};
|
||||
auto const module_path{folder.write("paint.wasm", paint_module)};
|
||||
script_screen_queue queue;
|
||||
REQUIRE(queue.init());
|
||||
|
||||
recording_texture texture;
|
||||
texture.ready = false;
|
||||
auto const screen{queue.acquire(request(script_language::wasm, module, "cab", &texture))};
|
||||
auto const screen{queue.acquire(request(script_language::wasm, module_path, "cab", &texture))};
|
||||
refresh(queue, screen, speed(9.0), 1);
|
||||
REQUIRE(run_until(queue, [] { return false == sent_commands().empty(); }));
|
||||
queue.update();
|
||||
@@ -350,12 +350,12 @@ TEST_CASE("wasm screens: the image goes up again when the texture is made anew,
|
||||
TEST_CASE("wasm screens: a screen outside the cab draws, but its commands are dropped") {
|
||||
sent_commands().clear();
|
||||
script_folder const folder{"wasm_sign"};
|
||||
auto const module{folder.write("paint.wasm", paint_module)};
|
||||
auto const module_path{folder.write("paint.wasm", paint_module)};
|
||||
script_screen_queue queue;
|
||||
REQUIRE(queue.init());
|
||||
|
||||
recording_texture texture;
|
||||
auto const screen{queue.acquire(request(script_language::wasm, module, "sign", &texture, script_screen_kind::external))};
|
||||
auto const screen{queue.acquire(request(script_language::wasm, module_path, "sign", &texture, script_screen_kind::external))};
|
||||
refresh(queue, screen, speed(3.0), 0);
|
||||
REQUIRE(run_until(queue, [&texture] { return texture.uploads > 0; }));
|
||||
queue.update();
|
||||
@@ -388,13 +388,13 @@ TEST_CASE("wasm screens: a screen stuck in a loop is stopped, and the others kee
|
||||
|
||||
TEST_CASE("wasm screens: the screens outlive the queue without harm") {
|
||||
script_folder const folder{"wasm_outlive"};
|
||||
auto const module{folder.write("paint.wasm", paint_module)};
|
||||
auto const module_path{folder.write("paint.wasm", paint_module)};
|
||||
std::shared_ptr<script_screen> screen;
|
||||
recording_texture texture;
|
||||
{
|
||||
script_screen_queue queue;
|
||||
REQUIRE(queue.init());
|
||||
screen = queue.acquire(request(script_language::wasm, module, "cab", &texture));
|
||||
screen = queue.acquire(request(script_language::wasm, module_path, "cab", &texture));
|
||||
refresh(queue, screen, speed(4.0), 1);
|
||||
REQUIRE(run_until(queue, [&texture] { return texture.uploads > 0; }));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user