mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-18 17:18:08 +08:00
Add code coverage support. (#378)
This commit is contained in:
@@ -189,8 +189,8 @@ float ElasticIn(float p) {
|
||||
// Modeled after the damped sine wave y = sin(-13pi/2*(x + 1))*pow(2, -10x) +
|
||||
// 1
|
||||
float ElasticOut(float p) {
|
||||
return std::sin(-13.F * kPi2 * (p + 1)) * std::pow(2.F, -10.F * p) +
|
||||
1; // NOLINT
|
||||
// NOLINTNEXTLINE
|
||||
return std::sin(-13.F * kPi2 * (p + 1)) * std::pow(2.F, -10.F * p) + 1;
|
||||
}
|
||||
|
||||
// Modeled after the piecewise exponentially-damped sine wave:
|
||||
|
@@ -55,6 +55,7 @@ Element DefaultTransform(EntryState params) { // NOLINT
|
||||
/// │Click to quit│
|
||||
/// └─────────────┘
|
||||
/// ```
|
||||
// NOLINTNEXTLINE(readability-function-cognitive-complexity)
|
||||
Component Button(ConstStringRef label,
|
||||
std::function<void()> on_click,
|
||||
Ref<ButtonOption> option) {
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#include "ftxui/component/component_base.hpp" // for ComponentBase, Component
|
||||
#include "gtest/gtest_pred_impl.h" // for EXPECT_EQ, Test, SuiteApiResolver, TEST, TestFactoryImpl
|
||||
|
||||
using namespace ftxui;
|
||||
namespace ftxui {
|
||||
|
||||
namespace {
|
||||
Component Make() {
|
||||
@@ -172,6 +172,8 @@ TEST(ComponentTest, NonFocusableAreNotFocused) {
|
||||
EXPECT_EQ(child->ActiveChild(), nullptr);
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
|
||||
// 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.
|
||||
|
@@ -8,14 +8,16 @@
|
||||
#include "ftxui/component/event.hpp" // for Event, Event::Tab, Event::TabReverse, Event::ArrowDown, Event::ArrowLeft, Event::ArrowRight, Event::ArrowUp
|
||||
#include "gtest/gtest_pred_impl.h" // for AssertionResult, EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, Test, TEST
|
||||
|
||||
using namespace ftxui;
|
||||
namespace ftxui {
|
||||
|
||||
namespace {
|
||||
Component Focusable() {
|
||||
return Button("", [] {});
|
||||
}
|
||||
Component NonFocusable() {
|
||||
return Container::Horizontal({});
|
||||
}
|
||||
} // namespace
|
||||
|
||||
TEST(ContainerTest, HorizontalEvent) {
|
||||
auto container = Container::Horizontal({});
|
||||
@@ -333,6 +335,8 @@ TEST(ContainerTest, TabFocusable) {
|
||||
EXPECT_FALSE(c->Focused());
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
|
||||
// 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.
|
||||
|
@@ -15,7 +15,7 @@
|
||||
#include "ftxui/util/ref.hpp" // for Ref
|
||||
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
||||
|
||||
using namespace ftxui;
|
||||
namespace ftxui {
|
||||
|
||||
TEST(InputTest, Init) {
|
||||
std::string content;
|
||||
@@ -372,6 +372,8 @@ TEST(InputTest, MouseClickComplex) {
|
||||
EXPECT_EQ(option.cursor_position(), 4u);
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
|
||||
// Copyright 2021 Arthur Sonzogni. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be found in
|
||||
// the LICENSE file.
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#include "ftxui/util/ref.hpp" // for Ref
|
||||
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
||||
|
||||
using namespace ftxui;
|
||||
namespace ftxui {
|
||||
|
||||
TEST(MenuTest, RemoveEntries) {
|
||||
int focused_entry = 0;
|
||||
@@ -43,6 +43,8 @@ TEST(MenuTest, RemoveEntries) {
|
||||
EXPECT_EQ(focused_entry, 1);
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
|
||||
// Copyright 2022 Arthur Sonzogni. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be found in
|
||||
// the LICENSE file.
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#include "ftxui/util/ref.hpp" // for Ref
|
||||
#include "gtest/gtest_pred_impl.h" // for EXPECT_EQ, Test, TEST
|
||||
|
||||
using namespace ftxui;
|
||||
namespace ftxui {
|
||||
|
||||
TEST(RadioboxTest, Navigation) {
|
||||
int selected = 0;
|
||||
@@ -145,6 +145,8 @@ TEST(RadioboxTest, RemoveEntries) {
|
||||
EXPECT_EQ(focused_entry, 1);
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
|
||||
// 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.
|
||||
|
@@ -6,7 +6,7 @@
|
||||
#include "ftxui/component/receiver.hpp"
|
||||
#include "gtest/gtest_pred_impl.h" // for AssertionResult, Test, EXPECT_EQ
|
||||
|
||||
using namespace ftxui;
|
||||
namespace ftxui {
|
||||
|
||||
TEST(Receiver, Basic) {
|
||||
auto receiver = MakeReceiver<char>();
|
||||
@@ -75,6 +75,8 @@ TEST(Receiver, BasicWithThread) {
|
||||
t23.join();
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
|
||||
// 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.
|
||||
|
@@ -7,7 +7,7 @@
|
||||
#include "ftxui/dom/elements.hpp" // for text, Element
|
||||
#include "gtest/gtest_pred_impl.h" // for Test, TEST, EXPECT_EQ
|
||||
|
||||
using namespace ftxui;
|
||||
namespace ftxui {
|
||||
|
||||
namespace {
|
||||
bool TestSignal(int signal) {
|
||||
@@ -47,6 +47,8 @@ TEST(ScreenInteractive, Signal_SIGFPE) {
|
||||
TestSignal(SIGFPE);
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
|
||||
// Copyright 2021 Arthur Sonzogni. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be found in
|
||||
// the LICENSE file.
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#include "ftxui/component/terminal_input_parser.hpp"
|
||||
#include "gtest/gtest_pred_impl.h" // for AssertionResult, Test, EXPECT_EQ, EXPECT_TRUE, EXPECT_FALSE, TEST
|
||||
|
||||
using namespace ftxui;
|
||||
namespace ftxui {
|
||||
|
||||
// Test char |c| to are trivially converted into |Event::Character(c)|.
|
||||
TEST(Event, Character) {
|
||||
@@ -232,6 +232,8 @@ TEST(Event, UTF8) {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
|
||||
// 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.
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#include "ftxui/screen/color.hpp" // for ftxui
|
||||
#include "ftxui/screen/screen.hpp" // for Screen
|
||||
|
||||
using namespace ftxui;
|
||||
namespace ftxui {
|
||||
|
||||
static void BencharkBasic(benchmark::State& state) {
|
||||
while (state.KeepRunning()) {
|
||||
@@ -30,6 +30,8 @@ static void BencharkBasic(benchmark::State& state) {
|
||||
}
|
||||
BENCHMARK(BencharkBasic)->DenseRange(0, 256, 16);
|
||||
|
||||
} // namespace ftxui
|
||||
|
||||
// Copyright 2021 Arthur Sonzogni. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be found in
|
||||
// the LICENSE file.l
|
||||
|
@@ -5,8 +5,7 @@
|
||||
#include "ftxui/dom/flexbox_helper.hpp"
|
||||
#include "gtest/gtest_pred_impl.h" // for EXPECT_EQ, Test, TEST
|
||||
|
||||
using namespace ftxui;
|
||||
using namespace ftxui;
|
||||
namespace ftxui {
|
||||
|
||||
TEST(FlexboxHelperTest, BasicRow) {
|
||||
flexbox_helper::Block block_10_5;
|
||||
@@ -228,6 +227,8 @@ TEST(FlexboxHelperTest, BasicColumnInversed) {
|
||||
EXPECT_EQ(g.blocks[4].dim_y, 5);
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
|
||||
// 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.
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#include "ftxui/screen/screen.hpp" // for Screen
|
||||
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
||||
|
||||
using namespace ftxui;
|
||||
namespace ftxui {
|
||||
|
||||
TEST(FlexboxTest, BasicRow) {
|
||||
auto root = flexbox(
|
||||
@@ -433,6 +433,8 @@ TEST(FlexboxTest, GapY) {
|
||||
" ");
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
|
||||
// Copyright 2021 Arthur Sonzogni. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be found in
|
||||
// the LICENSE file.
|
||||
|
@@ -8,8 +8,7 @@
|
||||
#include "ftxui/screen/screen.hpp" // for Screen
|
||||
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
||||
|
||||
using namespace ftxui;
|
||||
using namespace ftxui;
|
||||
namespace ftxui {
|
||||
|
||||
TEST(GaugeTest, ZeroHorizontal) {
|
||||
auto root = gauge(0);
|
||||
@@ -24,7 +23,11 @@ TEST(GaugeTest, HalfHorizontal) {
|
||||
Screen screen(11, 1);
|
||||
Render(screen, root);
|
||||
|
||||
#if defined(FTXUI_MICROSOFT_TERMINAL_FALLBACK)
|
||||
EXPECT_EQ("█████▌ ", screen.ToString());
|
||||
#else
|
||||
EXPECT_EQ("█████▍ ", screen.ToString());
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(GaugeTest, OneHorizontal) {
|
||||
@@ -95,6 +98,8 @@ TEST(GaugeTest, OneVertical) {
|
||||
screen.ToString());
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
|
||||
// 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.
|
||||
|
@@ -10,7 +10,7 @@
|
||||
#include "ftxui/screen/screen.hpp" // for Screen
|
||||
#include "gtest/gtest_pred_impl.h" // for Test, TEST, EXPECT_EQ
|
||||
|
||||
using namespace ftxui;
|
||||
namespace ftxui {
|
||||
|
||||
namespace {
|
||||
std::string rotate(std::string str) {
|
||||
@@ -175,7 +175,7 @@ TEST(GridboxTest, Horizontal_NoFlex_NoFlex_NoFlex) {
|
||||
"012abcABC ", //
|
||||
"012abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
@@ -203,7 +203,7 @@ TEST(GridboxTest, Vertical_NoFlex_NoFlex_NoFlex) {
|
||||
"012abcABC ", //
|
||||
"012abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(1, i);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], rotate(screen.ToString()));
|
||||
@@ -233,7 +233,7 @@ TEST(GridboxTest, Horizontal_FlexGrow_NoFlex_NoFlex) {
|
||||
"012 abcABC", //
|
||||
"012 abcABC", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
@@ -261,7 +261,7 @@ TEST(GridboxTest, Vertical_FlexGrow_NoFlex_NoFlex) {
|
||||
"012 abcABC", //
|
||||
"012 abcABC", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(1, i);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], rotate(screen.ToString()));
|
||||
@@ -291,7 +291,7 @@ TEST(GridboxTest, Horizontal_NoFlex_FlexGrow_NoFlex) {
|
||||
"012abc ABC", //
|
||||
"012abc ABC", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
@@ -321,7 +321,7 @@ TEST(GridboxTest, Horizontal_NoFlex_NoFlex_FlexGrow) {
|
||||
"012abcABC ", //
|
||||
"012abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
@@ -353,7 +353,7 @@ TEST(GridboxTest, Horizontal_FlexGrow_NoFlex_FlexGrow) {
|
||||
"012 abcABC ", //
|
||||
"012 abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
@@ -387,7 +387,7 @@ TEST(GridboxTest, Horizontal_FlexGrow_FlexGrow_FlexGrow) {
|
||||
"012 abc ABC ", //
|
||||
"012 abc ABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
@@ -419,7 +419,7 @@ TEST(GridboxTest, Horizontal_FlexShrink_NoFlex_NoFlex) {
|
||||
"012abcABC ", //
|
||||
"012abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
@@ -449,7 +449,7 @@ TEST(GridboxTest, Horizontal_NoFlex_FlexShrink_NoFlex) {
|
||||
"012abcABC ", //
|
||||
"012abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
@@ -479,7 +479,7 @@ TEST(GridboxTest, Horizontal_NoFlex_NoFlex_FlexShrink) {
|
||||
"012abcABC ", //
|
||||
"012abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
@@ -508,7 +508,7 @@ TEST(GridboxTest, Horizontal_FlexShrink_NoFlex_FlexShrink) {
|
||||
"012abcABC", //
|
||||
"012abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
@@ -539,7 +539,7 @@ TEST(GridboxTest, Horizontal_FlexShrink_FlexShrink_FlexShrink) {
|
||||
"012abcABC ", //
|
||||
"012abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
@@ -570,7 +570,7 @@ TEST(GridboxTest, Horizontal_FlexGrow_NoFlex_FlewShrink) {
|
||||
"012 abcABC", //
|
||||
"012 abcABC", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
@@ -596,6 +596,8 @@ TEST(GridboxTest, MissingCells) {
|
||||
" ");
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
|
||||
// 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.
|
||||
|
@@ -33,7 +33,7 @@ TEST(HBoxTest, NoFlex_NoFlex_NoFlex) {
|
||||
"012abcABC ", //
|
||||
"012abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
@@ -61,7 +61,7 @@ TEST(HBoxTest, FlexGrow_NoFlex_NoFlex) {
|
||||
"012 abcABC", //
|
||||
"012 abcABC", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
@@ -89,7 +89,7 @@ TEST(HBoxTest, NoFlex_FlexGrow_NoFlex) {
|
||||
"012abc ABC", //
|
||||
"012abc ABC", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
@@ -117,7 +117,7 @@ TEST(HBoxTest, NoFlex_NoFlex_FlexGrow) {
|
||||
"012abcABC ", //
|
||||
"012abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
@@ -147,7 +147,7 @@ TEST(HBoxTest, FlexGrow_NoFlex_FlexGrow) {
|
||||
"012 abcABC ", //
|
||||
"012 abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
@@ -179,7 +179,7 @@ TEST(HBoxTest, FlexGrow_FlexGrow_FlexGrow) {
|
||||
"012 abc ABC ", //
|
||||
"012 abc ABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
@@ -209,7 +209,7 @@ TEST(HBoxTest, FlexShrink_NoFlex_NoFlex) {
|
||||
"012abcABC ", //
|
||||
"012abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
@@ -237,7 +237,7 @@ TEST(HBoxTest, NoFlex_FlexShrink_NoFlex) {
|
||||
"012abcABC ", //
|
||||
"012abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
@@ -265,7 +265,7 @@ TEST(HBoxTest, NoFlex_NoFlex_FlexShrink) {
|
||||
"012abcABC ", //
|
||||
"012abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
@@ -292,7 +292,7 @@ TEST(HBoxTest, FlexShrink_NoFlex_FlexShrink) {
|
||||
"012abcABC", //
|
||||
"012abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
@@ -321,7 +321,7 @@ TEST(HBoxTest, FlexShrink_FlexShrink_FlexShrink) {
|
||||
"012abcABC ", //
|
||||
"012abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
@@ -350,7 +350,7 @@ TEST(HBoxTest, FlexGrow_NoFlex_FlewShrink) {
|
||||
"012 abcABC", //
|
||||
"012 abcABC", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(i, 1);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], screen.ToString());
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#include "ftxui/screen/screen.hpp" // for Screen
|
||||
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
||||
|
||||
using namespace ftxui;
|
||||
namespace ftxui {
|
||||
|
||||
TEST(TableTest, Empty) {
|
||||
auto table = Table();
|
||||
@@ -711,6 +711,8 @@ TEST(TableTest, RowFlexTwo) {
|
||||
screen.ToString());
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
|
||||
// Copyright 2021 Arthur Sonzogni. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be found in
|
||||
// the LICENSE file.
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#include "ftxui/screen/screen.hpp" // for Screen
|
||||
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
||||
|
||||
using namespace ftxui;
|
||||
namespace ftxui {
|
||||
|
||||
TEST(TextTest, ScreenHeightSmaller) {
|
||||
auto element = text("test");
|
||||
@@ -103,6 +103,8 @@ TEST(TextTest, CombiningCharacters) {
|
||||
EXPECT_EQ(t, screen.ToString());
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
|
||||
// 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.
|
||||
|
@@ -10,7 +10,8 @@
|
||||
#include "ftxui/screen/screen.hpp" // for Screen
|
||||
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
|
||||
|
||||
using namespace ftxui;
|
||||
namespace ftxui {
|
||||
namespace {
|
||||
|
||||
std::string rotate(std::string str) {
|
||||
str.erase(std::remove(str.begin(), str.end(), '\r'), str.end());
|
||||
@@ -18,6 +19,8 @@ std::string rotate(std::string str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST(VBoxText, NoFlex_NoFlex_NoFlex) {
|
||||
auto root = vbox({
|
||||
vtext("012"),
|
||||
@@ -39,7 +42,7 @@ TEST(VBoxText, NoFlex_NoFlex_NoFlex) {
|
||||
"012abcABC ", //
|
||||
"012abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(1, i);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], rotate(screen.ToString()));
|
||||
@@ -67,7 +70,7 @@ TEST(VBoxText, FlexGrow_NoFlex_NoFlex) {
|
||||
"012 abcABC", //
|
||||
"012 abcABC", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(1, i);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], rotate(screen.ToString()));
|
||||
@@ -95,7 +98,7 @@ TEST(VBoxText, NoFlex_FlexGrow_NoFlex) {
|
||||
"012abc ABC", //
|
||||
"012abc ABC", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(1, i);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], rotate(screen.ToString()));
|
||||
@@ -123,7 +126,7 @@ TEST(VBoxText, NoFlex_NoFlex_FlexGrow) {
|
||||
"012abcABC ", //
|
||||
"012abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(1, i);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], rotate(screen.ToString()));
|
||||
@@ -153,7 +156,7 @@ TEST(VBoxText, FlexGrow_NoFlex_FlexGrow) {
|
||||
"012 abcABC ", //
|
||||
"012 abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(1, i);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], rotate(screen.ToString()));
|
||||
@@ -185,7 +188,7 @@ TEST(VBoxText, FlexGrow_FlexGrow_FlexGrow) {
|
||||
"012 abc ABC ", //
|
||||
"012 abc ABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(1, i);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], rotate(screen.ToString()));
|
||||
@@ -215,7 +218,7 @@ TEST(VBoxText, FlexShrink_NoFlex_NoFlex) {
|
||||
"012abcABC ", //
|
||||
"012abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(1, i);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], rotate(screen.ToString()));
|
||||
@@ -243,7 +246,7 @@ TEST(VBoxText, NoFlex_FlexShrink_NoFlex) {
|
||||
"012abcABC ", //
|
||||
"012abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(1, i);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], rotate(screen.ToString()));
|
||||
@@ -271,7 +274,7 @@ TEST(VBoxText, NoFlex_NoFlex_FlexShrink) {
|
||||
"012abcABC ", //
|
||||
"012abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(1, i);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], rotate(screen.ToString()));
|
||||
@@ -298,7 +301,7 @@ TEST(VBoxText, FlexShrink_NoFlex_FlexShrink) {
|
||||
"012abcABC", //
|
||||
"012abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(1, i);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], rotate(screen.ToString()));
|
||||
@@ -327,7 +330,7 @@ TEST(VBoxText, FlexShrink_FlexShrink_FlexShrink) {
|
||||
"012abcABC ", //
|
||||
"012abcABC ", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(1, i);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], rotate(screen.ToString()));
|
||||
@@ -356,13 +359,15 @@ TEST(VBoxText, FlexGrow_NoFlex_FlewShrink) {
|
||||
"012 abcABC", //
|
||||
"012 abcABC", //
|
||||
};
|
||||
for (int i = 0; i < expectations.size(); ++i) {
|
||||
for (size_t i = 0; i < expectations.size(); ++i) {
|
||||
Screen screen(1, i);
|
||||
Render(screen, root);
|
||||
EXPECT_EQ(expectations[i], rotate(screen.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
|
||||
// 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.
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#include <stdint.h> // for uint8_t
|
||||
#include <cstdint> // for uint8_t
|
||||
#include <iostream> // for operator<<, stringstream, basic_ostream, flush, cout, ostream
|
||||
#include <map> // for _Rb_tree_const_iterator, map, operator!=, operator==
|
||||
#include <memory> // for allocator
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#include "ftxui/screen/string.hpp"
|
||||
#include "gtest/gtest_pred_impl.h" // for EXPECT_EQ, Test, TEST
|
||||
|
||||
using namespace ftxui;
|
||||
namespace ftxui {
|
||||
|
||||
TEST(StringTest, StringWidth) {
|
||||
// Basic:
|
||||
@@ -120,6 +120,7 @@ TEST(StringTest, CellToGlyphIndex) {
|
||||
EXPECT_EQ(combining[2], 2);
|
||||
}
|
||||
|
||||
}
|
||||
// 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