2018-10-10 01:06:03 +08:00
|
|
|
#include "ftxui/dom/elements.hpp"
|
2019-01-07 00:10:35 +08:00
|
|
|
#include "ftxui/screen/screen.hpp"
|
2018-09-18 14:48:40 +08:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
2019-01-12 22:00:08 +08:00
|
|
|
using namespace ftxui;
|
|
|
|
using namespace ftxui;
|
2018-09-18 14:48:40 +08:00
|
|
|
|
|
|
|
TEST(TextTest, ScreenHeightSmaller) {
|
|
|
|
auto element = text(L"test");
|
|
|
|
Screen screen(2, 0);
|
|
|
|
Render(screen, element.get());
|
|
|
|
|
|
|
|
EXPECT_EQ("", screen.ToString());
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(TextTest, ScreenSmaller) {
|
|
|
|
auto element = text(L"test");
|
|
|
|
Screen screen(2, 1);
|
|
|
|
Render(screen, element.get());
|
|
|
|
|
|
|
|
EXPECT_EQ("te", screen.ToString());
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(TextTest, ScreenFit) {
|
|
|
|
auto element = text(L"test");
|
|
|
|
Screen screen(4, 1);
|
|
|
|
Render(screen, element.get());
|
|
|
|
|
|
|
|
EXPECT_EQ("test", screen.ToString());
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(TextTest, ScreenBigger) {
|
|
|
|
auto element = text(L"test");
|
|
|
|
Screen screen(6, 1);
|
|
|
|
Render(screen, element.get());
|
|
|
|
|
|
|
|
EXPECT_EQ("test ", screen.ToString());
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(TextTest, ScreenBigger2) {
|
|
|
|
auto element = text(L"test");
|
|
|
|
Screen screen(6, 2);
|
|
|
|
Render(screen, element.get());
|
|
|
|
|
|
|
|
EXPECT_EQ("test \n ", screen.ToString());
|
|
|
|
}
|