mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-29 22:55:51 +08:00
Run clang-format.
This commit is contained in:
parent
1703552235
commit
fce29a03b3
@ -10,7 +10,6 @@
|
|||||||
#include "ftxui/component/toggle.hpp"
|
#include "ftxui/component/toggle.hpp"
|
||||||
#include "ftxui/screen/string.hpp"
|
#include "ftxui/screen/string.hpp"
|
||||||
|
|
||||||
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
int shift = 0;
|
int shift = 0;
|
||||||
|
@ -22,11 +22,7 @@ class MyComponent : public Component {
|
|||||||
|
|
||||||
container_.Add(&tab_container_);
|
container_.Add(&tab_container_);
|
||||||
|
|
||||||
menu_1_.entries = {
|
menu_1_.entries = {L"Forest", L"Water", L"I don't know"};
|
||||||
L"Forest",
|
|
||||||
L"Water",
|
|
||||||
L"I don't know"
|
|
||||||
};
|
|
||||||
tab_container_.Add(&menu_1_);
|
tab_container_.Add(&menu_1_);
|
||||||
|
|
||||||
menu_2_.entries = {
|
menu_2_.entries = {
|
||||||
@ -46,6 +42,7 @@ class MyComponent : public Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::function<void()> on_enter = []() {};
|
std::function<void()> on_enter = []() {};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Menu menu_;
|
Menu menu_;
|
||||||
Container container_ = Container::Horizontal();
|
Container container_ = Container::Horizontal();
|
||||||
@ -55,9 +52,7 @@ class MyComponent : public Component {
|
|||||||
Menu menu_3_;
|
Menu menu_3_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int main(int argc, const char* argv[]) {
|
||||||
int main(int argc, const char *argv[])
|
|
||||||
{
|
|
||||||
auto screen = ScreenInteractive::TerminalOutput();
|
auto screen = ScreenInteractive::TerminalOutput();
|
||||||
MyComponent component;
|
MyComponent component;
|
||||||
component.on_enter = screen.ExitLoopClosure();
|
component.on_enter = screen.ExitLoopClosure();
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include "ftxui/dom/elements.hpp"
|
#include "ftxui/dom/elements.hpp"
|
||||||
#include "ftxui/screen/screen.hpp"
|
#include "ftxui/screen/screen.hpp"
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, const char* argv[]) {
|
int main(int argc, const char* argv[]) {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#include "ftxui/screen/screen.hpp"
|
#include "ftxui/screen/screen.hpp"
|
||||||
#include "ftxui/screen/string.hpp"
|
#include "ftxui/screen/string.hpp"
|
||||||
|
|
||||||
|
|
||||||
class Graph {
|
class Graph {
|
||||||
public:
|
public:
|
||||||
std::vector<int> operator()(int width, int height) {
|
std::vector<int> operator()(int width, int height) {
|
||||||
|
@ -2,12 +2,11 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#include "ftxui/screen/screen.hpp"
|
|
||||||
#include "ftxui/dom/elements.hpp"
|
#include "ftxui/dom/elements.hpp"
|
||||||
|
#include "ftxui/screen/screen.hpp"
|
||||||
#include "ftxui/screen/string.hpp"
|
#include "ftxui/screen/string.hpp"
|
||||||
|
|
||||||
int main(int argc, const char *argv[])
|
int main(int argc, const char* argv[]) {
|
||||||
{
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "ftxui/dom/elements.hpp"
|
|
||||||
#include "ftxui/screen/screen.hpp"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
int main(int argc, const char *argv[])
|
#include "ftxui/dom/elements.hpp"
|
||||||
{
|
#include "ftxui/screen/screen.hpp"
|
||||||
|
|
||||||
|
int main(int argc, const char* argv[]) {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
// clang-format off
|
// clang-format off
|
||||||
auto document =
|
auto document =
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "ftxui/screen/screen.hpp"
|
|
||||||
#include "ftxui/dom/elements.hpp"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
int main(int argc, const char *argv[])
|
#include "ftxui/dom/elements.hpp"
|
||||||
{
|
#include "ftxui/screen/screen.hpp"
|
||||||
|
|
||||||
|
int main(int argc, const char* argv[]) {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
// clang-format off
|
// clang-format off
|
||||||
auto document =
|
auto document =
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "ftxui/screen/screen.hpp"
|
|
||||||
#include "ftxui/dom/elements.hpp"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
int main(int argc, const char *argv[])
|
#include "ftxui/dom/elements.hpp"
|
||||||
{
|
#include "ftxui/screen/screen.hpp"
|
||||||
|
|
||||||
|
int main(int argc, const char* argv[]) {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
// clang-format off
|
// clang-format off
|
||||||
auto document =
|
auto document =
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "ftxui/screen/screen.hpp"
|
|
||||||
#include "ftxui/dom/elements.hpp"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
int main(int argc, const char *argv[])
|
#include "ftxui/dom/elements.hpp"
|
||||||
{
|
#include "ftxui/screen/screen.hpp"
|
||||||
|
|
||||||
|
int main(int argc, const char* argv[]) {
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
// clang-format off
|
// clang-format off
|
||||||
auto document =
|
auto document =
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
#include "ftxui/screen/screen.hpp"
|
|
||||||
#include "ftxui/dom/elements.hpp"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "ftxui/dom/elements.hpp"
|
||||||
|
#include "ftxui/screen/screen.hpp"
|
||||||
|
|
||||||
int main(int argc, const char *argv[])
|
int main(int argc, const char* argv[]) {
|
||||||
{
|
|
||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
// clang-format off
|
// clang-format off
|
||||||
auto document =
|
auto document =
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
#ifndef FTXUI_COMPONENT_RECEIVER_HPP_
|
#ifndef FTXUI_COMPONENT_RECEIVER_HPP_
|
||||||
#define FTXUI_COMPONENT_RECEIVER_HPP_
|
#define FTXUI_COMPONENT_RECEIVER_HPP_
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
@ -75,5 +75,4 @@ TEST(RadioboxTest, Navigation) {
|
|||||||
radiobox.OnEvent(Event::TabReverse);
|
radiobox.OnEvent(Event::TabReverse);
|
||||||
EXPECT_EQ(radiobox.focused, 1);
|
EXPECT_EQ(radiobox.focused, 1);
|
||||||
radiobox.OnEvent(Event::TabReverse);
|
radiobox.OnEvent(Event::TabReverse);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -58,10 +58,14 @@ TEST(Receiver, BasicWithThread) {
|
|||||||
s1_bis.reset();
|
s1_bis.reset();
|
||||||
|
|
||||||
char c;
|
char c;
|
||||||
EXPECT_TRUE(r3->Receive(&c));EXPECT_EQ(c, '1');
|
EXPECT_TRUE(r3->Receive(&c));
|
||||||
EXPECT_TRUE(r3->Receive(&c)); EXPECT_EQ(c, '2');
|
EXPECT_EQ(c, '1');
|
||||||
EXPECT_TRUE(r3->Receive(&c)); EXPECT_EQ(c, '3');
|
EXPECT_TRUE(r3->Receive(&c));
|
||||||
EXPECT_TRUE(r3->Receive(&c)); EXPECT_EQ(c, '4');
|
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));
|
EXPECT_FALSE(r3->Receive(&c));
|
||||||
|
|
||||||
// Thread will end at the end of the stream.
|
// Thread will end at the end of the stream.
|
||||||
|
@ -70,5 +70,4 @@ TEST(ToggleTest, Tab) {
|
|||||||
toggle.OnEvent(Event::TabReverse);
|
toggle.OnEvent(Event::TabReverse);
|
||||||
EXPECT_EQ(toggle.selected, 1);
|
EXPECT_EQ(toggle.selected, 1);
|
||||||
toggle.OnEvent(Event::TabReverse);
|
toggle.OnEvent(Event::TabReverse);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,7 @@ using namespace ftxui;
|
|||||||
using namespace ftxui;
|
using namespace ftxui;
|
||||||
|
|
||||||
TEST(HBoxTest, ScreenSmaller1) {
|
TEST(HBoxTest, ScreenSmaller1) {
|
||||||
auto root = hbox(
|
auto root = hbox(text(L"text_1"), text(L"text_2"));
|
||||||
text(L"text_1"),
|
|
||||||
text(L"text_2")
|
|
||||||
);
|
|
||||||
Screen screen(11, 1);
|
Screen screen(11, 1);
|
||||||
Render(screen, root.get());
|
Render(screen, root.get());
|
||||||
|
|
||||||
@ -17,10 +14,7 @@ TEST(HBoxTest, ScreenSmaller1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(HBoxTest, ScreenSmaller2) {
|
TEST(HBoxTest, ScreenSmaller2) {
|
||||||
auto root = hbox(
|
auto root = hbox(text(L"text_1"), text(L"text_2"));
|
||||||
text(L"text_1"),
|
|
||||||
text(L"text_2")
|
|
||||||
);
|
|
||||||
Screen screen(10, 1);
|
Screen screen(10, 1);
|
||||||
Render(screen, root.get());
|
Render(screen, root.get());
|
||||||
|
|
||||||
@ -28,10 +22,7 @@ TEST(HBoxTest, ScreenSmaller2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(HBoxTest, ScreenFit) {
|
TEST(HBoxTest, ScreenFit) {
|
||||||
auto root = hbox(
|
auto root = hbox(text(L"text_1"), text(L"text_2"));
|
||||||
text(L"text_1"),
|
|
||||||
text(L"text_2")
|
|
||||||
);
|
|
||||||
Screen screen(12, 1);
|
Screen screen(12, 1);
|
||||||
Render(screen, root.get());
|
Render(screen, root.get());
|
||||||
|
|
||||||
@ -39,20 +30,14 @@ TEST(HBoxTest, ScreenFit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(HBoxTest, ScreenBigger1) {
|
TEST(HBoxTest, ScreenBigger1) {
|
||||||
auto root = hbox(
|
auto root = hbox(text(L"text_1"), text(L"text_2"));
|
||||||
text(L"text_1"),
|
|
||||||
text(L"text_2")
|
|
||||||
);
|
|
||||||
Screen screen(13, 1);
|
Screen screen(13, 1);
|
||||||
Render(screen, root.get());
|
Render(screen, root.get());
|
||||||
|
|
||||||
EXPECT_EQ("text_1text_2 ", screen.ToString());
|
EXPECT_EQ("text_1text_2 ", screen.ToString());
|
||||||
}
|
}
|
||||||
TEST(HBoxTest, ScreenBigger2) {
|
TEST(HBoxTest, ScreenBigger2) {
|
||||||
auto root = hbox(
|
auto root = hbox(text(L"text_1"), text(L"text_2"));
|
||||||
text(L"text_1"),
|
|
||||||
text(L"text_2")
|
|
||||||
);
|
|
||||||
Screen screen(14, 1);
|
Screen screen(14, 1);
|
||||||
Render(screen, root.get());
|
Render(screen, root.get());
|
||||||
|
|
||||||
@ -60,11 +45,7 @@ TEST(HBoxTest, ScreenBigger2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(HBoxTest, ScreenSmaller1Flex) {
|
TEST(HBoxTest, ScreenSmaller1Flex) {
|
||||||
auto root = hbox(
|
auto root = hbox(text(L"text_1"), filler(), text(L"text_2"));
|
||||||
text(L"text_1"),
|
|
||||||
filler(),
|
|
||||||
text(L"text_2")
|
|
||||||
);
|
|
||||||
Screen screen(11, 1);
|
Screen screen(11, 1);
|
||||||
Render(screen, root.get());
|
Render(screen, root.get());
|
||||||
|
|
||||||
@ -72,11 +53,7 @@ TEST(HBoxTest, ScreenSmaller1Flex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(HBoxTest, ScreenSmaller2Flex) {
|
TEST(HBoxTest, ScreenSmaller2Flex) {
|
||||||
auto root = hbox(
|
auto root = hbox(text(L"text_1"), filler(), text(L"text_2"));
|
||||||
text(L"text_1"),
|
|
||||||
filler(),
|
|
||||||
text(L"text_2")
|
|
||||||
);
|
|
||||||
Screen screen(10, 1);
|
Screen screen(10, 1);
|
||||||
Render(screen, root.get());
|
Render(screen, root.get());
|
||||||
|
|
||||||
@ -84,11 +61,7 @@ TEST(HBoxTest, ScreenSmaller2Flex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(HBoxTest, ScreenFitFlex) {
|
TEST(HBoxTest, ScreenFitFlex) {
|
||||||
auto root = hbox(
|
auto root = hbox(text(L"text_1"), filler(), text(L"text_2"));
|
||||||
text(L"text_1"),
|
|
||||||
filler(),
|
|
||||||
text(L"text_2")
|
|
||||||
);
|
|
||||||
Screen screen(12, 1);
|
Screen screen(12, 1);
|
||||||
Render(screen, root.get());
|
Render(screen, root.get());
|
||||||
|
|
||||||
@ -96,11 +69,7 @@ TEST(HBoxTest, ScreenFitFlex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(HBoxTest, ScreenBigger1Flex) {
|
TEST(HBoxTest, ScreenBigger1Flex) {
|
||||||
auto root = hbox(
|
auto root = hbox(text(L"text_1"), filler(), text(L"text_2"));
|
||||||
text(L"text_1"),
|
|
||||||
filler(),
|
|
||||||
text(L"text_2")
|
|
||||||
);
|
|
||||||
Screen screen(13, 1);
|
Screen screen(13, 1);
|
||||||
Render(screen, root.get());
|
Render(screen, root.get());
|
||||||
|
|
||||||
@ -108,11 +77,7 @@ TEST(HBoxTest, ScreenBigger1Flex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(HBoxTest, ScreenBigger2Flex) {
|
TEST(HBoxTest, ScreenBigger2Flex) {
|
||||||
auto root = hbox(
|
auto root = hbox(text(L"text_1"), filler(), text(L"text_2"));
|
||||||
text(L"text_1"),
|
|
||||||
filler(),
|
|
||||||
text(L"text_2")
|
|
||||||
);
|
|
||||||
Screen screen(14, 1);
|
Screen screen(14, 1);
|
||||||
Render(screen, root.get());
|
Render(screen, root.get());
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <iostream>
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "ftxui/dom/elements.hpp"
|
#include "ftxui/dom/elements.hpp"
|
||||||
#include "ftxui/dom/node.hpp"
|
#include "ftxui/dom/node.hpp"
|
||||||
|
@ -54,8 +54,8 @@ TEST(VBoxTest, ScreenFitFlex) {
|
|||||||
" \n"
|
" \n"
|
||||||
" \n"
|
" \n"
|
||||||
" \n"
|
" \n"
|
||||||
"text_2 "
|
"text_2 ",
|
||||||
,screen.ToString());
|
screen.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(VBoxTest, ScreenBigger1Flex) {
|
TEST(VBoxTest, ScreenBigger1Flex) {
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#include "ftxui/screen/string.hpp"
|
#include "ftxui/screen/string.hpp"
|
||||||
#include "ftxui/screen/terminal.hpp"
|
#include "ftxui/screen/terminal.hpp"
|
||||||
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include <codecvt>
|
#include <codecvt>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4996) // codecvt_utf8_utf16 is deprecated
|
#pragma warning(disable : 4996) // codecvt_utf8_utf16 is deprecated
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
|
Loading…
Reference in New Issue
Block a user