mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-26 04:31:34 +08:00
execute IWYU and add some coverage tests.
This commit is contained in:
parent
84d6e6b3dd
commit
d0890f94d1
@ -11,36 +11,21 @@ namespace ftxui {
|
|||||||
|
|
||||||
TEST(AnimationTest, StartAndEnd) {
|
TEST(AnimationTest, StartAndEnd) {
|
||||||
std::vector<animation::easing::Function> functions = {
|
std::vector<animation::easing::Function> functions = {
|
||||||
animation::easing::Linear,
|
animation::easing::Linear, animation::easing::QuadraticIn,
|
||||||
animation::easing::QuadraticIn,
|
animation::easing::QuadraticOut, animation::easing::QuadraticInOut,
|
||||||
animation::easing::QuadraticOut,
|
animation::easing::CubicIn, animation::easing::CubicOut,
|
||||||
animation::easing::QuadraticInOut,
|
animation::easing::CubicInOut, animation::easing::QuarticIn,
|
||||||
animation::easing::CubicIn,
|
animation::easing::QuarticOut, animation::easing::QuarticInOut,
|
||||||
animation::easing::CubicOut,
|
animation::easing::QuinticIn, animation::easing::QuinticOut,
|
||||||
animation::easing::CubicInOut,
|
animation::easing::QuinticInOut, animation::easing::SineIn,
|
||||||
animation::easing::QuarticIn,
|
animation::easing::SineOut, animation::easing::SineInOut,
|
||||||
animation::easing::QuarticOut,
|
animation::easing::CircularIn, animation::easing::CircularOut,
|
||||||
animation::easing::QuarticInOut,
|
animation::easing::CircularInOut, animation::easing::ExponentialIn,
|
||||||
animation::easing::QuinticIn,
|
animation::easing::ExponentialOut, animation::easing::ExponentialInOut,
|
||||||
animation::easing::QuinticOut,
|
animation::easing::ElasticIn, animation::easing::ElasticOut,
|
||||||
animation::easing::QuinticInOut,
|
animation::easing::ElasticInOut, animation::easing::BackIn,
|
||||||
animation::easing::SineIn,
|
animation::easing::BackOut, animation::easing::BackInOut,
|
||||||
animation::easing::SineOut,
|
animation::easing::BounceIn, animation::easing::BounceOut,
|
||||||
animation::easing::SineInOut,
|
|
||||||
animation::easing::CircularIn,
|
|
||||||
animation::easing::CircularOut,
|
|
||||||
animation::easing::CircularInOut,
|
|
||||||
animation::easing::ExponentialIn,
|
|
||||||
animation::easing::ExponentialOut,
|
|
||||||
animation::easing::ExponentialInOut,
|
|
||||||
animation::easing::ElasticIn,
|
|
||||||
animation::easing::ElasticOut,
|
|
||||||
animation::easing::ElasticInOut,
|
|
||||||
animation::easing::BackIn,
|
|
||||||
animation::easing::BackOut,
|
|
||||||
animation::easing::BackInOut,
|
|
||||||
animation::easing::BounceIn,
|
|
||||||
animation::easing::BounceOut,
|
|
||||||
animation::easing::BounceInOut,
|
animation::easing::BounceInOut,
|
||||||
};
|
};
|
||||||
for (auto& it : functions) {
|
for (auto& it : functions) {
|
||||||
|
@ -115,9 +115,8 @@ class MenuBase : public ComponentBase {
|
|||||||
bool is_focused = (focused_entry() == i) && is_menu_focused;
|
bool is_focused = (focused_entry() == i) && is_menu_focused;
|
||||||
bool is_selected = (*selected_ == i);
|
bool is_selected = (*selected_ == i);
|
||||||
|
|
||||||
auto focus_management = !is_selected ? nothing
|
auto focus_management =
|
||||||
: is_menu_focused ? focus
|
!is_selected ? nothing : is_menu_focused ? focus : nothing;
|
||||||
: nothing;
|
|
||||||
EntryState state = {
|
EntryState state = {
|
||||||
entries_[i],
|
entries_[i],
|
||||||
false,
|
false,
|
||||||
|
@ -43,6 +43,53 @@ TEST(MenuTest, RemoveEntries) {
|
|||||||
EXPECT_EQ(focused_entry, 1);
|
EXPECT_EQ(focused_entry, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(MenuTest, Directions) {
|
||||||
|
int selected = 0;
|
||||||
|
std::vector<std::string> entries = {"1", "2", "3"};
|
||||||
|
MenuOption option;
|
||||||
|
auto menu = Menu(&entries, &selected, &option);
|
||||||
|
|
||||||
|
{
|
||||||
|
option.direction = MenuOption::Down;
|
||||||
|
Screen screen(4, 3);
|
||||||
|
Render(screen, menu->Render());
|
||||||
|
EXPECT_EQ(screen.ToString(),
|
||||||
|
"\x1B[1m\x1B[7m> 1 \x1B[22m\x1B[27m\r\n"
|
||||||
|
" 2 \r\n"
|
||||||
|
" 3 ");
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
option.direction = MenuOption::Up;
|
||||||
|
Screen screen(4, 3);
|
||||||
|
Render(screen, menu->Render());
|
||||||
|
EXPECT_EQ(screen.ToString(),
|
||||||
|
" 3 \r\n"
|
||||||
|
" 2 \r\n"
|
||||||
|
"\x1B[1m\x1B[7m> 1 \x1B[22m\x1B[27m");
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
option.direction = MenuOption::Right;
|
||||||
|
Screen screen(10, 1);
|
||||||
|
Render(screen, menu->Render());
|
||||||
|
EXPECT_EQ(screen.ToString(),
|
||||||
|
"\x1B[1m\x1B[7m> 1\x1B[22m\x1B[27m"
|
||||||
|
" 2"
|
||||||
|
" 3 ");
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
option.direction = MenuOption::Left;
|
||||||
|
Screen screen(10, 1);
|
||||||
|
Render(screen, menu->Render());
|
||||||
|
EXPECT_EQ(screen.ToString(),
|
||||||
|
" 3"
|
||||||
|
" 2"
|
||||||
|
"\x1B[1m\x1B[7m> 1\x1B[22m\x1B[27m ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ftxui
|
} // namespace ftxui
|
||||||
|
|
||||||
// Copyright 2022 Arthur Sonzogni. All rights reserved.
|
// Copyright 2022 Arthur Sonzogni. All rights reserved.
|
||||||
|
@ -39,9 +39,8 @@ class RadioboxBase : public ComponentBase {
|
|||||||
for (int i = 0; i < size(); ++i) {
|
for (int i = 0; i < size(); ++i) {
|
||||||
bool is_focused = (focused_entry() == i) && is_menu_focused;
|
bool is_focused = (focused_entry() == i) && is_menu_focused;
|
||||||
bool is_selected = (hovered_ == i);
|
bool is_selected = (hovered_ == i);
|
||||||
auto focus_management = !is_selected ? nothing
|
auto focus_management =
|
||||||
: is_menu_focused ? focus
|
!is_selected ? nothing : is_menu_focused ? focus : select;
|
||||||
: select;
|
|
||||||
auto state = EntryState{
|
auto state = EntryState{
|
||||||
entries_[i],
|
entries_[i],
|
||||||
*selected_ == i,
|
*selected_ == i,
|
||||||
|
@ -310,7 +310,7 @@ TEST(Event, Control) {
|
|||||||
cases.push_back({char(26), true});
|
cases.push_back({char(26), true});
|
||||||
cases.push_back({char(127), false});
|
cases.push_back({char(127), false});
|
||||||
|
|
||||||
for(auto test : cases) {
|
for (auto test : cases) {
|
||||||
auto event_receiver = MakeReceiver<Task>();
|
auto event_receiver = MakeReceiver<Task>();
|
||||||
{
|
{
|
||||||
auto parser = TerminalInputParser(event_receiver->MakeSender());
|
auto parser = TerminalInputParser(event_receiver->MakeSender());
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include <gtest/gtest-message.h> // for Message
|
#include <gtest/gtest-message.h> // for Message
|
||||||
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult
|
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult
|
||||||
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
|
||||||
#include <string> // for allocator
|
#include <string> // for allocator
|
||||||
#include "ftxui/dom/elements.hpp" // for text, flexbox
|
#include "ftxui/dom/elements.hpp" // for text, flexbox
|
||||||
#include "ftxui/screen/screen.hpp" // for Screen
|
#include "ftxui/screen/screen.hpp" // for Screen
|
||||||
|
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
||||||
|
|
||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ TEST(BlinkTest, Basic) {
|
|||||||
auto element = text("text") | blink;
|
auto element = text("text") | blink;
|
||||||
Screen screen(5, 1);
|
Screen screen(5, 1);
|
||||||
Render(screen, element);
|
Render(screen, element);
|
||||||
EXPECT_TRUE(screen.PixelAt(0,0).blink);
|
EXPECT_TRUE(screen.PixelAt(0, 0).blink);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ftxui
|
} // namespace ftxui
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include <gtest/gtest-message.h> // for Message
|
#include <gtest/gtest-message.h> // for Message
|
||||||
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult
|
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult
|
||||||
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
|
||||||
#include <string> // for allocator
|
#include <string> // for allocator
|
||||||
#include "ftxui/dom/elements.hpp" // for text, flexbox
|
#include "ftxui/dom/elements.hpp" // for text, flexbox
|
||||||
#include "ftxui/screen/screen.hpp" // for Screen
|
#include "ftxui/screen/screen.hpp" // for Screen
|
||||||
|
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
||||||
|
|
||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ TEST(BoldTest, Basic) {
|
|||||||
auto element = text("text") | bold;
|
auto element = text("text") | bold;
|
||||||
Screen screen(5, 1);
|
Screen screen(5, 1);
|
||||||
Render(screen, element);
|
Render(screen, element);
|
||||||
EXPECT_TRUE(screen.PixelAt(0,0).bold);
|
EXPECT_TRUE(screen.PixelAt(0, 0).bold);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ftxui
|
} // namespace ftxui
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include <gtest/gtest-message.h> // for Message
|
#include <gtest/gtest-message.h> // for Message
|
||||||
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult
|
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult
|
||||||
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
|
||||||
#include <string> // for allocator
|
#include <string> // for allocator
|
||||||
#include "ftxui/dom/elements.hpp" // for text, flexbox
|
#include "ftxui/dom/elements.hpp" // for text, flexbox
|
||||||
#include "ftxui/screen/screen.hpp" // for Screen
|
#include "ftxui/screen/screen.hpp" // for Screen
|
||||||
|
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
||||||
|
|
||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include <gtest/gtest-message.h> // for Message
|
#include <gtest/gtest-message.h> // for Message
|
||||||
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult
|
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult
|
||||||
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
|
||||||
#include <string> // for allocator
|
#include <string> // for allocator
|
||||||
#include "ftxui/dom/elements.hpp" // for text, flexbox
|
#include "ftxui/dom/elements.hpp" // for text, flexbox
|
||||||
#include "ftxui/screen/screen.hpp" // for Screen
|
#include "ftxui/screen/screen.hpp" // for Screen
|
||||||
|
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
||||||
|
|
||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ uint32_t Hash(const std::string s) {
|
|||||||
}
|
}
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
TEST(CanvasTest, GoldPoint) {
|
TEST(CanvasTest, GoldPoint) {
|
||||||
Terminal::SetColorSupport(Terminal::Color::TrueColor);
|
Terminal::SetColorSupport(Terminal::Color::TrueColor);
|
||||||
@ -40,7 +40,7 @@ TEST(CanvasTest, GoldPointColor) {
|
|||||||
Terminal::SetColorSupport(Terminal::Color::TrueColor);
|
Terminal::SetColorSupport(Terminal::Color::TrueColor);
|
||||||
auto element = canvas([](Canvas& c) { //
|
auto element = canvas([](Canvas& c) { //
|
||||||
c.DrawPoint(3, 3, 1, Color::Red);
|
c.DrawPoint(3, 3, 1, Color::Red);
|
||||||
c.DrawPointLine(3, 7, 10, 19,Color::Blue);
|
c.DrawPointLine(3, 7, 10, 19, Color::Blue);
|
||||||
c.DrawPointCircle(10, 5, 3, Color::Yellow);
|
c.DrawPointCircle(10, 5, 3, Color::Yellow);
|
||||||
c.DrawPointCircleFilled(20, 5, 3, Color::White);
|
c.DrawPointCircleFilled(20, 5, 3, Color::White);
|
||||||
c.DrawPointEllipse(10, 10, 5, 2, Color::Black);
|
c.DrawPointEllipse(10, 10, 5, 2, Color::Black);
|
||||||
@ -84,7 +84,6 @@ TEST(CanvasTest, GoldBlockColor) {
|
|||||||
EXPECT_EQ(Hash(screen.ToString()), 2869205941);
|
EXPECT_EQ(Hash(screen.ToString()), 2869205941);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST(CanvasTest, GoldText) {
|
TEST(CanvasTest, GoldText) {
|
||||||
Terminal::SetColorSupport(Terminal::Color::TrueColor);
|
Terminal::SetColorSupport(Terminal::Color::TrueColor);
|
||||||
Canvas c(10, 10);
|
Canvas c(10, 10);
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include <gtest/gtest-message.h> // for Message
|
#include <gtest/gtest-message.h> // for Message
|
||||||
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult
|
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult
|
||||||
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
|
||||||
#include <string> // for allocator
|
#include <string> // for allocator
|
||||||
#include "ftxui/dom/elements.hpp" // for text, flexbox
|
#include "ftxui/dom/elements.hpp" // for text, flexbox
|
||||||
#include "ftxui/screen/screen.hpp" // for Screen
|
#include "ftxui/screen/screen.hpp" // for Screen
|
||||||
|
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
||||||
|
|
||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include <gtest/gtest-message.h> // for Message
|
#include <gtest/gtest-message.h> // for Message
|
||||||
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult
|
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult
|
||||||
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
|
||||||
#include <string> // for allocator
|
#include <string> // for allocator
|
||||||
#include "ftxui/dom/elements.hpp" // for text, flexbox
|
#include "ftxui/dom/elements.hpp" // for text, flexbox
|
||||||
#include "ftxui/screen/screen.hpp" // for Screen
|
#include "ftxui/screen/screen.hpp" // for Screen
|
||||||
|
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
||||||
|
|
||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ TEST(DimTest, Basic) {
|
|||||||
auto element = text("text") | dim;
|
auto element = text("text") | dim;
|
||||||
Screen screen(5, 1);
|
Screen screen(5, 1);
|
||||||
Render(screen, element);
|
Render(screen, element);
|
||||||
EXPECT_TRUE(screen.PixelAt(0,0).dim);
|
EXPECT_TRUE(screen.PixelAt(0, 0).dim);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ftxui
|
} // namespace ftxui
|
||||||
|
@ -358,7 +358,6 @@ void Compute(Global& global) {
|
|||||||
Compute1(global);
|
Compute1(global);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace ftxui::flexbox_helper
|
} // namespace ftxui::flexbox_helper
|
||||||
|
|
||||||
// Copyright 2021 Arthur Sonzogni. All rights reserved.
|
// Copyright 2021 Arthur Sonzogni. All rights reserved.
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include <gtest/gtest-message.h> // for Message
|
#include <gtest/gtest-message.h> // for Message
|
||||||
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult
|
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult
|
||||||
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
|
||||||
#include <string> // for allocator
|
#include <string> // for allocator
|
||||||
#include "ftxui/dom/elements.hpp" // for text, flexbox
|
#include "ftxui/dom/elements.hpp" // for text, flexbox
|
||||||
#include "ftxui/screen/screen.hpp" // for Screen
|
#include "ftxui/screen/screen.hpp" // for Screen
|
||||||
|
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
||||||
|
|
||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include <gtest/gtest-message.h> // for Message
|
#include <gtest/gtest-message.h> // for Message
|
||||||
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult
|
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult
|
||||||
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
|
||||||
#include <string> // for allocator
|
#include <string> // for allocator
|
||||||
#include "ftxui/dom/elements.hpp" // for text, flexbox
|
#include "ftxui/dom/elements.hpp" // for text, flexbox
|
||||||
#include "ftxui/screen/screen.hpp" // for Screen
|
#include "ftxui/screen/screen.hpp" // for Screen
|
||||||
|
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
||||||
|
|
||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include <gtest/gtest-message.h> // for Message
|
#include <gtest/gtest-message.h> // for Message
|
||||||
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult
|
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult
|
||||||
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
|
||||||
#include <string> // for allocator
|
#include <string> // for allocator
|
||||||
#include "ftxui/dom/elements.hpp" // for text, flexbox
|
#include "ftxui/dom/elements.hpp" // for text, flexbox
|
||||||
#include "ftxui/screen/screen.hpp" // for Screen
|
#include "ftxui/screen/screen.hpp" // for Screen
|
||||||
|
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
||||||
|
|
||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include <gtest/gtest-message.h> // for Message
|
#include <gtest/gtest-message.h> // for Message
|
||||||
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult
|
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult
|
||||||
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
|
||||||
#include <string> // for allocator
|
#include <string> // for allocator
|
||||||
#include "ftxui/dom/elements.hpp" // for text, flexbox
|
#include "ftxui/dom/elements.hpp" // for text, flexbox
|
||||||
#include "ftxui/screen/screen.hpp" // for Screen
|
#include "ftxui/screen/screen.hpp" // for Screen
|
||||||
|
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
||||||
|
|
||||||
namespace ftxui {
|
namespace ftxui {
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ TEST(UnderlinedTest, Basic) {
|
|||||||
auto element = text("text") | underlined;
|
auto element = text("text") | underlined;
|
||||||
Screen screen(5, 1);
|
Screen screen(5, 1);
|
||||||
Render(screen, element);
|
Render(screen, element);
|
||||||
EXPECT_TRUE(screen.PixelAt(0,0).underlined);
|
EXPECT_TRUE(screen.PixelAt(0, 0).underlined);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ftxui
|
} // namespace ftxui
|
||||||
|
@ -26,18 +26,18 @@ TEST(ColorTest, PrintColor256) {
|
|||||||
|
|
||||||
TEST(ColorTest, PrintTrueCOlor) {
|
TEST(ColorTest, PrintTrueCOlor) {
|
||||||
Terminal::SetColorSupport(Terminal::Color::TrueColor);
|
Terminal::SetColorSupport(Terminal::Color::TrueColor);
|
||||||
EXPECT_EQ(Color::RGB(1,2,3).Print(false), "38;2;1;2;3");
|
EXPECT_EQ(Color::RGB(1, 2, 3).Print(false), "38;2;1;2;3");
|
||||||
EXPECT_EQ(Color::RGB(1,2,3).Print(true), "48;2;1;2;3");
|
EXPECT_EQ(Color::RGB(1, 2, 3).Print(true), "48;2;1;2;3");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ColorTest, FallbackTo256) {
|
TEST(ColorTest, FallbackTo256) {
|
||||||
Terminal::SetColorSupport(Terminal::Color::Palette256);
|
Terminal::SetColorSupport(Terminal::Color::Palette256);
|
||||||
EXPECT_EQ(Color::RGB(1,2,3).Print(false), "38;5;16");
|
EXPECT_EQ(Color::RGB(1, 2, 3).Print(false), "38;5;16");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ColorTest, FallbackTo16) {
|
TEST(ColorTest, FallbackTo16) {
|
||||||
Terminal::SetColorSupport(Terminal::Color::Palette16);
|
Terminal::SetColorSupport(Terminal::Color::Palette16);
|
||||||
EXPECT_EQ(Color::RGB(1,2,3).Print(false), "30");
|
EXPECT_EQ(Color::RGB(1, 2, 3).Print(false), "30");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ColorTest, Litterals) {
|
TEST(ColorTest, Litterals) {
|
||||||
|
@ -120,7 +120,7 @@ TEST(StringTest, CellToGlyphIndex) {
|
|||||||
EXPECT_EQ(combining[2], 2);
|
EXPECT_EQ(combining[2], 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace ftxui
|
||||||
// Copyright 2020 Arthur Sonzogni. All rights reserved.
|
// Copyright 2020 Arthur Sonzogni. All rights reserved.
|
||||||
// Use of this source code is governed by the MIT license that can be found in
|
// Use of this source code is governed by the MIT license that can be found in
|
||||||
// the LICENSE file.
|
// the LICENSE file.
|
||||||
|
Loading…
Reference in New Issue
Block a user