Recommendation for Unit Testing? #644
-
Hi, I'm hoping to use FTXUI for a project of mine. I'm looking in to how I can unit test the interactive GUI and capture mouse events, click events, etc... Is there a recommendation for what to use to accomplish this? End goal is fairly thorough code coverage. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
FTXUI should be quite easy to test, because you can send arbitrary events to a component, and check how it ends up affecting the UI state. The UI state is mainly stored from outside of FTXUI. You can take example from pre-existing FTXUI tests: It boiles down to: State myState;
Component myComponent = Mycomponent(&myState);
myComponent->OnEvent(Event::Character("a"));
EXPECT_EQ(myState, expected) |
Beta Was this translation helpful? Give feedback.
FTXUI should be quite easy to test, because you can send arbitrary events to a component, and check how it ends up affecting the UI state. The UI state is mainly stored from outside of FTXUI.
You can take example from pre-existing FTXUI tests:
https://github.com/ArthurSonzogni/FTXUI/blob/main/src/ftxui/component/input_test.cpp
It boiles down to: