From: Bartosz Golaszewski Date: Thu, 16 Mar 2023 09:03:10 +0000 (+0100) Subject: bindings: cxx: tests: add a test case for chip::unwatch_line_info() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=f2245fa32c1bccd171e53c579bd272a6d2c01c61;p=qemu-gpiodev%2Flibgpiod.git bindings: cxx: tests: add a test case for chip::unwatch_line_info() We don't have any test case for chip::unwatch_line_info() so add a simple one similar to the one we have for the core C library. Signed-off-by: Bartosz Golaszewski --- diff --git a/bindings/cxx/tests/tests-info-event.cpp b/bindings/cxx/tests/tests-info-event.cpp index 2ec5176..ee31496 100644 --- a/bindings/cxx/tests/tests-info-event.cpp +++ b/bindings/cxx/tests/tests-info-event.cpp @@ -103,6 +103,30 @@ TEST_CASE("Lines can be watched", "[info-event][chip]") } } +TEST_CASE("line info can be unwatched", "[info-event]") +{ + auto sim = make_sim() + .set_num_lines(8) + .build(); + + ::gpiod::chip chip(sim.dev_path()); + + auto info = chip.watch_line_info(5); + + auto request = chip + .prepare_request() + .add_line_settings(5, ::gpiod::line_settings()) + .do_request(); + + REQUIRE(chip.wait_info_event(::std::chrono::seconds(1))); + auto event = chip.read_info_event(); + REQUIRE(event.type() == event_type::LINE_REQUESTED); + + chip.unwatch_line_info(5); + + REQUIRE_FALSE(chip.wait_info_event(::std::chrono::milliseconds(100))); +} + TEST_CASE("info_event can be copied and moved", "[info-event]") { auto sim = make_sim().build();