| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | // Copyright 2021 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #include <catch2/catch_all.hpp> |
| 5 | |
| 6 | #include "common/commandqueuestub.h" |
| 7 | #include "core/components/controls/noop.h" |
| 8 | |
| 9 | namespace Tests::Noop { |
| 10 | |
| 11 | class NoopTestAdapter : public ::Noop |
| 12 | { |
| 13 | public: |
| 14 | using ::Noop::Noop; |
| 15 | |
| 16 | using ::Noop::cleanControl; |
| 17 | using ::Noop::syncControl; |
| 18 | }; |
| 19 | |
| 20 | TEST_CASE("Noop control tests", "[Noop]") |
| 21 | { |
| 22 | CommandQueueStub ctlCmds; |
| 23 | |
| 24 | SECTION("Has Noop ID") |
| 25 | { |
| 26 | NoopTestAdapter ts; |
| 27 | |
| 28 | REQUIRE(ts.ID() == ::Noop::ItemID); |
| 29 | } |
| 30 | |
| 31 | SECTION("Is active by default") |
| 32 | { |
| 33 | NoopTestAdapter ts; |
| 34 | |
| 35 | REQUIRE(ts.active()); |
| 36 | } |
| 37 | |
| 38 | SECTION("Does not generate pre-init control commands") |
| 39 | { |
| 40 | NoopTestAdapter ts; |
| 41 | ts.preInit(ctlCmds); |
| 42 | |
| 43 | REQUIRE(ctlCmds.commands().empty()); |
| 44 | } |
| 45 | |
| 46 | SECTION("Does not generate post-init control commands") |
| 47 | { |
| 48 | NoopTestAdapter ts; |
| 49 | ts.postInit(ctlCmds); |
| 50 | |
| 51 | REQUIRE(ctlCmds.commands().empty()); |
| 52 | } |
| 53 | |
| 54 | SECTION("Does not generate clean control commands") |
| 55 | { |
| 56 | NoopTestAdapter ts; |
| 57 | ts.cleanControl(ctlCmds); |
| 58 | |
| 59 | REQUIRE(ctlCmds.commands().empty()); |
| 60 | } |
| 61 | |
| 62 | SECTION("Does not generate sync control commands") |
| 63 | { |
| 64 | NoopTestAdapter ts; |
| 65 | ts.syncControl(ctlCmds); |
| 66 | |
| 67 | REQUIRE(ctlCmds.commands().empty()); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | } // namespace Tests::Noop |