mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-18 00:48:09 +08:00
Run clang-format.
This commit is contained in:
@@ -75,5 +75,4 @@ TEST(RadioboxTest, Navigation) {
|
||||
radiobox.OnEvent(Event::TabReverse);
|
||||
EXPECT_EQ(radiobox.focused, 1);
|
||||
radiobox.OnEvent(Event::TabReverse);
|
||||
|
||||
}
|
||||
|
@@ -58,10 +58,14 @@ TEST(Receiver, BasicWithThread) {
|
||||
s1_bis.reset();
|
||||
|
||||
char c;
|
||||
EXPECT_TRUE(r3->Receive(&c));EXPECT_EQ(c, '1');
|
||||
EXPECT_TRUE(r3->Receive(&c)); EXPECT_EQ(c, '2');
|
||||
EXPECT_TRUE(r3->Receive(&c)); EXPECT_EQ(c, '3');
|
||||
EXPECT_TRUE(r3->Receive(&c)); EXPECT_EQ(c, '4');
|
||||
EXPECT_TRUE(r3->Receive(&c));
|
||||
EXPECT_EQ(c, '1');
|
||||
EXPECT_TRUE(r3->Receive(&c));
|
||||
EXPECT_EQ(c, '2');
|
||||
EXPECT_TRUE(r3->Receive(&c));
|
||||
EXPECT_EQ(c, '3');
|
||||
EXPECT_TRUE(r3->Receive(&c));
|
||||
EXPECT_EQ(c, '4');
|
||||
EXPECT_FALSE(r3->Receive(&c));
|
||||
|
||||
// Thread will end at the end of the stream.
|
||||
|
@@ -70,5 +70,4 @@ TEST(ToggleTest, Tab) {
|
||||
toggle.OnEvent(Event::TabReverse);
|
||||
EXPECT_EQ(toggle.selected, 1);
|
||||
toggle.OnEvent(Event::TabReverse);
|
||||
|
||||
}
|
||||
|
@@ -6,114 +6,79 @@ using namespace ftxui;
|
||||
using namespace ftxui;
|
||||
|
||||
TEST(HBoxTest, ScreenSmaller1) {
|
||||
auto root = hbox(
|
||||
text(L"text_1"),
|
||||
text(L"text_2")
|
||||
);
|
||||
Screen screen(11,1);
|
||||
auto root = hbox(text(L"text_1"), text(L"text_2"));
|
||||
Screen screen(11, 1);
|
||||
Render(screen, root.get());
|
||||
|
||||
EXPECT_EQ("text_1text_", screen.ToString());
|
||||
}
|
||||
|
||||
TEST(HBoxTest, ScreenSmaller2) {
|
||||
auto root = hbox(
|
||||
text(L"text_1"),
|
||||
text(L"text_2")
|
||||
);
|
||||
Screen screen(10,1);
|
||||
auto root = hbox(text(L"text_1"), text(L"text_2"));
|
||||
Screen screen(10, 1);
|
||||
Render(screen, root.get());
|
||||
|
||||
EXPECT_EQ("text_1text", screen.ToString());
|
||||
}
|
||||
|
||||
TEST(HBoxTest, ScreenFit) {
|
||||
auto root = hbox(
|
||||
text(L"text_1"),
|
||||
text(L"text_2")
|
||||
);
|
||||
Screen screen(12,1);
|
||||
auto root = hbox(text(L"text_1"), text(L"text_2"));
|
||||
Screen screen(12, 1);
|
||||
Render(screen, root.get());
|
||||
|
||||
EXPECT_EQ("text_1text_2", screen.ToString());
|
||||
}
|
||||
|
||||
TEST(HBoxTest, ScreenBigger1) {
|
||||
auto root = hbox(
|
||||
text(L"text_1"),
|
||||
text(L"text_2")
|
||||
);
|
||||
Screen screen(13,1);
|
||||
auto root = hbox(text(L"text_1"), text(L"text_2"));
|
||||
Screen screen(13, 1);
|
||||
Render(screen, root.get());
|
||||
|
||||
EXPECT_EQ("text_1text_2 ", screen.ToString());
|
||||
}
|
||||
TEST(HBoxTest, ScreenBigger2) {
|
||||
auto root = hbox(
|
||||
text(L"text_1"),
|
||||
text(L"text_2")
|
||||
);
|
||||
Screen screen(14,1);
|
||||
auto root = hbox(text(L"text_1"), text(L"text_2"));
|
||||
Screen screen(14, 1);
|
||||
Render(screen, root.get());
|
||||
|
||||
EXPECT_EQ("text_1text_2 ", screen.ToString());
|
||||
}
|
||||
|
||||
TEST(HBoxTest, ScreenSmaller1Flex) {
|
||||
auto root = hbox(
|
||||
text(L"text_1"),
|
||||
filler(),
|
||||
text(L"text_2")
|
||||
);
|
||||
Screen screen(11,1);
|
||||
auto root = hbox(text(L"text_1"), filler(), text(L"text_2"));
|
||||
Screen screen(11, 1);
|
||||
Render(screen, root.get());
|
||||
|
||||
EXPECT_EQ("text_1text_", screen.ToString());
|
||||
}
|
||||
|
||||
TEST(HBoxTest, ScreenSmaller2Flex) {
|
||||
auto root = hbox(
|
||||
text(L"text_1"),
|
||||
filler(),
|
||||
text(L"text_2")
|
||||
);
|
||||
Screen screen(10,1);
|
||||
auto root = hbox(text(L"text_1"), filler(), text(L"text_2"));
|
||||
Screen screen(10, 1);
|
||||
Render(screen, root.get());
|
||||
|
||||
EXPECT_EQ("text_1text", screen.ToString());
|
||||
}
|
||||
|
||||
TEST(HBoxTest, ScreenFitFlex) {
|
||||
auto root = hbox(
|
||||
text(L"text_1"),
|
||||
filler(),
|
||||
text(L"text_2")
|
||||
);
|
||||
Screen screen(12,1);
|
||||
auto root = hbox(text(L"text_1"), filler(), text(L"text_2"));
|
||||
Screen screen(12, 1);
|
||||
Render(screen, root.get());
|
||||
|
||||
EXPECT_EQ("text_1text_2", screen.ToString());
|
||||
}
|
||||
|
||||
TEST(HBoxTest, ScreenBigger1Flex) {
|
||||
auto root = hbox(
|
||||
text(L"text_1"),
|
||||
filler(),
|
||||
text(L"text_2")
|
||||
);
|
||||
Screen screen(13,1);
|
||||
auto root = hbox(text(L"text_1"), filler(), text(L"text_2"));
|
||||
Screen screen(13, 1);
|
||||
Render(screen, root.get());
|
||||
|
||||
EXPECT_EQ("text_1 text_2", screen.ToString());
|
||||
}
|
||||
|
||||
TEST(HBoxTest, ScreenBigger2Flex) {
|
||||
auto root = hbox(
|
||||
text(L"text_1"),
|
||||
filler(),
|
||||
text(L"text_2")
|
||||
);
|
||||
Screen screen(14,1);
|
||||
auto root = hbox(text(L"text_1"), filler(), text(L"text_2"));
|
||||
Screen screen(14, 1);
|
||||
Render(screen, root.get());
|
||||
|
||||
EXPECT_EQ("text_1 text_2", screen.ToString());
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
#include "ftxui/dom/elements.hpp"
|
||||
#include "ftxui/dom/node.hpp"
|
||||
|
@@ -50,12 +50,12 @@ TEST(VBoxTest, ScreenFitFlex) {
|
||||
Render(screen, root.get());
|
||||
|
||||
EXPECT_EQ(
|
||||
"text_1 \n"
|
||||
" \n"
|
||||
" \n"
|
||||
" \n"
|
||||
"text_2 "
|
||||
,screen.ToString());
|
||||
"text_1 \n"
|
||||
" \n"
|
||||
" \n"
|
||||
" \n"
|
||||
"text_2 ",
|
||||
screen.ToString());
|
||||
}
|
||||
|
||||
TEST(VBoxTest, ScreenBigger1Flex) {
|
||||
|
@@ -7,7 +7,6 @@
|
||||
#include "ftxui/screen/string.hpp"
|
||||
#include "ftxui/screen/terminal.hpp"
|
||||
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
|
@@ -3,10 +3,9 @@
|
||||
#include <codecvt>
|
||||
#include <locale>
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4996) // codecvt_utf8_utf16 is deprecated
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4996) // codecvt_utf8_utf16 is deprecated
|
||||
#endif
|
||||
|
||||
std::string to_string(const std::wstring& s) {
|
||||
@@ -20,5 +19,5 @@ std::wstring to_wstring(const std::string& s) {
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#pragma warning(pop)
|
||||
#endif
|
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
|
Reference in New Issue
Block a user