2022-08-07 20:44:33 +08:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include <string> // for allocator
|
2022-04-27 20:00:46 +08:00
|
|
|
|
2022-04-28 16:43:31 +08:00
|
|
|
#include "ftxui/dom/elements.hpp" // for filler, operator|, text, border, dbox, hbox, vbox, Element
|
2022-04-27 20:00:46 +08:00
|
|
|
#include "ftxui/dom/node.hpp" // for Render
|
|
|
|
#include "ftxui/screen/screen.hpp" // for Screen
|
|
|
|
|
|
|
|
namespace ftxui {
|
|
|
|
|
|
|
|
TEST(DBoxTest, Basic) {
|
|
|
|
auto root = dbox({
|
|
|
|
hbox({
|
|
|
|
text("test") | border,
|
|
|
|
filler(),
|
|
|
|
}),
|
|
|
|
vbox({
|
|
|
|
text("test") | border,
|
|
|
|
filler(),
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
|
|
|
|
Screen screen(8, 4);
|
|
|
|
Render(screen, root);
|
|
|
|
EXPECT_EQ(screen.ToString(),
|
|
|
|
"╭────┬─╮\r\n"
|
|
|
|
"│test│ │\r\n"
|
|
|
|
"╰────┴─╯\r\n"
|
|
|
|
"╰────╯ ");
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace ftxui
|
|
|
|
|
|
|
|
// Copyright 2020 Arthur Sonzogni. All rights reserved.
|
|
|
|
// Use of this source code is governed by the MIT license that can be found in
|
|
|
|
// the LICENSE file.
|