ui::testing::TestNotifier¶
Header: winui/testing/TestNotifier.hpp.
Derives from ui::Notifier.
Notifier test double: shows nothing, keeps every notification it was handed, and clicks one on request.
Install it with set_notifier(); ui::notify() then reaches it. It uninstalls itself when destroyed.
Example:
ui::testing::TestNotifier notifier;
ui::testing::set_notifier(¬ifier);
bool opened = false;
ui::notify({.title = "Export finished", .on_click = [&] { opened = true; }});
REQUIRE(notifier.shown.size() == 1);
REQUIRE(notifier.shown[0].title == "Export finished");
notifier.click(0);
REQUIRE(opened);
shown¶
Every notification shown so far, oldest first.
TestNotifier¶
~TestNotifier¶
Uninstalls it if it is still the installed notifier.
TestNotifier¶
operator=¶
notify¶
Appends notification to shown.
click¶
What a user's click on shown[index] does: runs its on_click, if it has one.