mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-18 00:48:09 +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.
|
||||
|
Reference in New Issue
Block a user