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-10-10 01:06:03 +08:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
2019-01-12 22:00:08 +08:00
|
|
|
using namespace ftxui;
|
|
|
|
using namespace ftxui;
|
2018-10-10 01:06:03 +08:00
|
|
|
|
|
|
|
TEST(GaugeTest, zero) {
|
|
|
|
auto root = gauge(0);
|
2020-03-23 05:32:44 +08:00
|
|
|
Screen screen(11, 1);
|
2018-10-10 01:06:03 +08:00
|
|
|
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);
|
2018-10-10 01:06:03 +08:00
|
|
|
Render(screen, root.get());
|
|
|
|
|
2019-01-06 23:10:57 +08:00
|
|
|
EXPECT_EQ("█████▍ ", screen.ToString());
|
|
|
|
//" ▏▎▍▌▊▉█";
|
2018-10-10 01:06:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(GaugeTest, one) {
|
|
|
|
auto root = gauge(1.0);
|
2020-03-23 05:32:44 +08:00
|
|
|
Screen screen(11, 1);
|
2018-10-10 01:06:03 +08:00
|
|
|
Render(screen, root.get());
|
|
|
|
|
|
|
|
EXPECT_EQ("███████████", screen.ToString());
|
|
|
|
}
|