mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-29 16:39:34 +08:00
Gauge direction (#326)
Add `gauge` with all the different directions. Co-authored-by: Aleksandar Brakmic <13668697+brakmic-aleksandar@users.noreply.github.com>
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
using namespace ftxui;
|
||||
using namespace ftxui;
|
||||
|
||||
TEST(GaugeTest, zero) {
|
||||
TEST(GaugeTest, ZeroHorizontal) {
|
||||
auto root = gauge(0);
|
||||
Screen screen(11, 1);
|
||||
Render(screen, root);
|
||||
@@ -19,16 +19,15 @@ TEST(GaugeTest, zero) {
|
||||
EXPECT_EQ(" ", screen.ToString());
|
||||
}
|
||||
|
||||
TEST(GaugeTest, half) {
|
||||
TEST(GaugeTest, HalfHorizontal) {
|
||||
auto root = gauge(0.5);
|
||||
Screen screen(11, 1);
|
||||
Render(screen, root);
|
||||
|
||||
EXPECT_EQ("█████▍ ", screen.ToString());
|
||||
//" ▏▎▍▌▊▉█";
|
||||
}
|
||||
|
||||
TEST(GaugeTest, one) {
|
||||
TEST(GaugeTest, OneHorizontal) {
|
||||
auto root = gauge(1.0);
|
||||
Screen screen(11, 1);
|
||||
Render(screen, root);
|
||||
@@ -36,6 +35,66 @@ TEST(GaugeTest, one) {
|
||||
EXPECT_EQ("███████████", screen.ToString());
|
||||
}
|
||||
|
||||
TEST(GaugeTest, ZeroVertical) {
|
||||
auto root = gaugeUp(0);
|
||||
Screen screen(1, 11);
|
||||
Render(screen, root);
|
||||
|
||||
EXPECT_EQ(
|
||||
" \r\n"
|
||||
" \r\n"
|
||||
" \r\n"
|
||||
" \r\n"
|
||||
" \r\n"
|
||||
" \r\n"
|
||||
" \r\n"
|
||||
" \r\n"
|
||||
" \r\n"
|
||||
" \r\n"
|
||||
" ",
|
||||
screen.ToString());
|
||||
}
|
||||
|
||||
TEST(GaugeTest, HalfVertical) {
|
||||
auto root = gaugeUp(0.5);
|
||||
Screen screen(1, 11);
|
||||
Render(screen, root);
|
||||
|
||||
EXPECT_EQ(
|
||||
" \r\n"
|
||||
" \r\n"
|
||||
" \r\n"
|
||||
" \r\n"
|
||||
" \r\n"
|
||||
"▄\r\n"
|
||||
"█\r\n"
|
||||
"█\r\n"
|
||||
"█\r\n"
|
||||
"█\r\n"
|
||||
"█",
|
||||
screen.ToString());
|
||||
}
|
||||
|
||||
TEST(GaugeTest, OneVertical) {
|
||||
auto root = gaugeUp(1.0);
|
||||
Screen screen(1, 11);
|
||||
Render(screen, root);
|
||||
|
||||
EXPECT_EQ(
|
||||
"█\r\n"
|
||||
"█\r\n"
|
||||
"█\r\n"
|
||||
"█\r\n"
|
||||
"█\r\n"
|
||||
"█\r\n"
|
||||
"█\r\n"
|
||||
"█\r\n"
|
||||
"█\r\n"
|
||||
"█\r\n"
|
||||
"█",
|
||||
screen.ToString());
|
||||
}
|
||||
|
||||
// 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.
|
||||
|
Reference in New Issue
Block a user