FTXUI/tests/gauge_test.cpp

32 lines
668 B
C++
Raw Normal View History

#include "ftxui/dom/elements.hpp"
#include "ftxui/screen/screen.hpp"
#include "gtest/gtest.h"
using namespace ftxui;
using namespace ftxui;
TEST(GaugeTest, zero) {
auto root = gauge(0);
2020-03-23 05:32:44 +08:00
Screen screen(11, 1);
Render(screen, root.get());
EXPECT_EQ(" ", screen.ToString());
}
TEST(GaugeTest, half) {
auto root = gauge(0.5);
2020-03-23 05:32:44 +08:00
Screen screen(11, 1);
Render(screen, root.get());
EXPECT_EQ("█████▍ ", screen.ToString());
//" ▏▎▍▌▊▉█";
}
TEST(GaugeTest, one) {
auto root = gauge(1.0);
2020-03-23 05:32:44 +08:00
Screen screen(11, 1);
Render(screen, root.get());
EXPECT_EQ("███████████", screen.ToString());
}