mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-07-29 00:21:14 +08:00
Add example.
This commit is contained in:
parent
842ba7e5f3
commit
30e0fdcdd4
@ -19,7 +19,7 @@ namespace ftxui {
|
||||
|
||||
namespace {
|
||||
Component BasicComponent() {
|
||||
return Renderer([] { return text(""); });
|
||||
return Renderer([](bool focused) { return text(""); });
|
||||
}
|
||||
|
||||
Event MousePressed(int x, int y) {
|
||||
@ -207,5 +207,32 @@ TEST(ResizableSplit, BasicBottomWithCustomSeparator) {
|
||||
EXPECT_EQ(position, 2);
|
||||
}
|
||||
|
||||
TEST(ResizableSplit, NavigationVertical) {
|
||||
int position = 0;
|
||||
auto component_top = BasicComponent();
|
||||
auto component_bottom = BasicComponent();
|
||||
auto component =
|
||||
ResizableSplitTop(component_top, component_bottom, &position);
|
||||
|
||||
EXPECT_TRUE(component_top->Active());
|
||||
EXPECT_FALSE(component_bottom->Active());
|
||||
|
||||
EXPECT_FALSE(component->OnEvent(Event::ArrowRight));
|
||||
EXPECT_TRUE(component_top->Active());
|
||||
EXPECT_FALSE(component_bottom->Active());
|
||||
|
||||
EXPECT_TRUE(component->OnEvent(Event::ArrowDown));
|
||||
EXPECT_FALSE(component_top->Active());
|
||||
EXPECT_TRUE(component_bottom->Active());
|
||||
|
||||
EXPECT_FALSE(component->OnEvent(Event::ArrowDown));
|
||||
EXPECT_FALSE(component_top->Active());
|
||||
EXPECT_TRUE(component_bottom->Active());
|
||||
|
||||
EXPECT_TRUE(component->OnEvent(Event::ArrowUp));
|
||||
EXPECT_TRUE(component_top->Active());
|
||||
EXPECT_FALSE(component_bottom->Active());
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
// NOLINTEND
|
||||
|
Loading…
Reference in New Issue
Block a user