mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-29 16:39:34 +08:00
Multiple fixes: signed/unsigned, etc... (#600)
Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "ftxui/component/animation.hpp"
|
||||
|
||||
// NOLINTBEGIN(*-magic-numbers)
|
||||
namespace ftxui::animation {
|
||||
|
||||
namespace easing {
|
||||
@@ -44,9 +45,7 @@ float QuadraticOut(float p) {
|
||||
// y = (1/2)((2x)^2) ; [0, 0.5)
|
||||
// y = -(1/2)((2x-1)*(2x-3) - 1) ; [0.5, 1]
|
||||
float QuadraticInOut(float p) {
|
||||
return p < 0.5f // NOLINT
|
||||
? 2.f * p * p // NOLINT
|
||||
: (-2.f * p * p) + (4.f * p) - 1.f; // NOLINT
|
||||
return p < 0.5f ? 2.f * p * p : (-2.f * p * p) + (4.f * p) - 1.f;
|
||||
}
|
||||
|
||||
// Modeled after the cubic y = x^3
|
||||
@@ -64,11 +63,11 @@ float CubicOut(float p) {
|
||||
// y = (1/2)((2x)^3) ; [0, 0.5)
|
||||
// y = (1/2)((2x-2)^3 + 2) ; [0.5, 1]
|
||||
float CubicInOut(float p) {
|
||||
if (p < 0.5f) { // NOLINT
|
||||
if (p < 0.5f) {
|
||||
return 4.f * p * p * p;
|
||||
}
|
||||
const float f = ((2.f * p) - 2.f);
|
||||
return 0.5f * f * f * f + 1.f; // NOLINT
|
||||
return 0.5f * f * f * f + 1.f;
|
||||
}
|
||||
|
||||
// Modeled after the quartic x^4
|
||||
@@ -86,11 +85,11 @@ float QuarticOut(float p) {
|
||||
// y = (1/2)((2x)^4) ; [0, 0.5)
|
||||
// y = -(1/2)((2x-2)^4 - 2) ; [0.5, 1]
|
||||
float QuarticInOut(float p) {
|
||||
if (p < 0.5f) { // NOLINT
|
||||
return 8.f * p * p * p * p; // NOLINT
|
||||
if (p < 0.5f) {
|
||||
return 8.f * p * p * p * p;
|
||||
}
|
||||
const float f = (p - 1.f);
|
||||
return -8.f * f * f * f * f + 1.f; // NOLINT
|
||||
return -8.f * f * f * f * f + 1.f;
|
||||
}
|
||||
|
||||
// Modeled after the quintic y = x^5
|
||||
@@ -108,11 +107,11 @@ float QuinticOut(float p) {
|
||||
// y = (1/2)((2x)^5) ; [0, 0.5)
|
||||
// y = (1/2)((2x-2)^5 + 2) ; [0.5, 1]
|
||||
float QuinticInOut(float p) {
|
||||
if (p < 0.5f) { // NOLINT
|
||||
return 16.f * p * p * p * p * p; // NOLINT
|
||||
if (p < 0.5f) {
|
||||
return 16.f * p * p * p * p * p;
|
||||
}
|
||||
float f = ((2.f * p) - 2.f); // NOLINT
|
||||
return 0.5f * f * f * f * f * f + 1.f; // NOLINT
|
||||
const float f = ((2.f * p) - 2.f);
|
||||
return 0.5f * f * f * f * f * f + 1.f;
|
||||
}
|
||||
|
||||
// Modeled after quarter-cycle of sine wave
|
||||
@@ -127,7 +126,7 @@ float SineOut(float p) {
|
||||
|
||||
// Modeled after half sine wave
|
||||
float SineInOut(float p) {
|
||||
return 0.5f * (1.f - std::cos(p * kPi)); // NOLINT
|
||||
return 0.5f * (1.f - std::cos(p * kPi));
|
||||
}
|
||||
|
||||
// Modeled after shifted quadrant IV of unit circle
|
||||
@@ -144,21 +143,20 @@ float CircularOut(float p) {
|
||||
// y = (1/2)(1 - sqrt(1 - 4x^2)) ; [0, 0.5)
|
||||
// y = (1/2)(sqrt(-(2x - 3)*(2x - 1)) + 1) ; [0.5, 1]
|
||||
float CircularInOut(float p) {
|
||||
if (p < 0.5f) { // NOLINT
|
||||
return 0.5f * (1.f - std::sqrt(1.f - 4.f * (p * p))); // NOLINT
|
||||
if (p < 0.5f) {
|
||||
return 0.5f * (1.f - std::sqrt(1.f - 4.f * (p * p)));
|
||||
}
|
||||
// NOLINTNEXTLINE
|
||||
return 0.5f * (std::sqrt(-((2.f * p) - 3.f) * ((2.f * p) - 1.f)) + 1.f);
|
||||
}
|
||||
|
||||
// Modeled after the exponential function y = 2^(10(x - 1))
|
||||
float ExponentialIn(float p) {
|
||||
return (p == 0.f) ? p : std::pow(2.f, 10.f * (p - 1.f)); // NOLINT
|
||||
return (p == 0.f) ? p : std::pow(2.f, 10.f * (p - 1.f));
|
||||
}
|
||||
|
||||
// Modeled after the exponential function y = -2^(-10x) + 1
|
||||
float ExponentialOut(float p) {
|
||||
return (p == 1.f) ? p : 1.f - std::pow(2.f, -10.f * p); // NOLINT
|
||||
return (p == 1.f) ? p : 1.f - std::pow(2.f, -10.f * p);
|
||||
}
|
||||
|
||||
// Modeled after the piecewise exponential
|
||||
@@ -169,21 +167,20 @@ float ExponentialInOut(float p) {
|
||||
return p;
|
||||
}
|
||||
|
||||
if (p < 0.5f) { // NOLINT
|
||||
return 0.5f * std::pow(2.f, (20.f * p) - 10.f); // NOLINT
|
||||
if (p < 0.5f) {
|
||||
return 0.5f * std::pow(2.f, (20.f * p) - 10.f);
|
||||
}
|
||||
return -0.5f * std::pow(2.f, (-20.f * p) + 10.f) + 1.f; // NOLINT
|
||||
return -0.5f * std::pow(2.f, (-20.f * p) + 10.f) + 1.f;
|
||||
}
|
||||
|
||||
// Modeled after the damped sine wave y = sin(13pi/2*x)*pow(2, 10 * (x - 1))
|
||||
float ElasticIn(float p) {
|
||||
return std::sin(13.f * kPi2 * p) * std::pow(2.f, 10.f * (p - 1.f)); // NOLINT
|
||||
return std::sin(13.f * kPi2 * p) * std::pow(2.f, 10.f * (p - 1.f));
|
||||
}
|
||||
|
||||
// Modeled after the damped sine wave y = sin(-13pi/2*(x + 1))*pow(2, -10x) +
|
||||
// 1
|
||||
float ElasticOut(float p) {
|
||||
// NOLINTNEXTLINE
|
||||
return std::sin(-13.f * kPi2 * (p + 1.f)) * std::pow(2.f, -10.f * p) + 1.f;
|
||||
}
|
||||
|
||||
@@ -191,13 +188,13 @@ float ElasticOut(float p) {
|
||||
// y = (1/2)*sin(13pi/2*(2*x))*pow(2, 10 * ((2*x) - 1)) ; [0,0.5)
|
||||
// y = (1/2)*(sin(-13pi/2*((2x-1)+1))*pow(2,-10(2*x-1)) + 2) ; [0.5, 1]
|
||||
float ElasticInOut(float p) {
|
||||
if (p < 0.5f) { // NOLINT
|
||||
return 0.5f * std::sin(13.f * kPi2 * (2.f * p)) * // NOLINT
|
||||
std::pow(2.f, 10.f * ((2.f * p) - 1.f)); // NOLINT
|
||||
if (p < 0.5f) {
|
||||
return 0.5f * std::sin(13.f * kPi2 * (2.f * p)) *
|
||||
std::pow(2.f, 10.f * ((2.f * p) - 1.f));
|
||||
}
|
||||
return 0.5f * (std::sin(-13.f * kPi2 * ((2.f * p - 1.f) + 1.f)) * // NOLINT
|
||||
std::pow(2.f, -10.f * (2.f * p - 1.f)) + // NOLINT
|
||||
2.f); // NOLINT
|
||||
return 0.5f * (std::sin(-13.f * kPi2 * ((2.f * p - 1.f) + 1.f)) *
|
||||
std::pow(2.f, -10.f * (2.f * p - 1.f)) +
|
||||
2.f);
|
||||
}
|
||||
|
||||
// Modeled after the overshooting cubic y = x^3-x*sin(x*pi)
|
||||
@@ -215,12 +212,12 @@ float BackOut(float p) {
|
||||
// y = (1/2)*((2x)^3-(2x)*sin(2*x*pi)) ; [0, 0.5)
|
||||
// y = (1/2)*(1-((1-x)^3-(1-x)*sin((1-x)*pi))+1) ; [0.5, 1]
|
||||
float BackInOut(float p) {
|
||||
if (p < 0.5f) { // NOLINT
|
||||
if (p < 0.5f) {
|
||||
const float f = 2.f * p;
|
||||
return 0.5f * (f * f * f - f * std::sin(f * kPi)); // NOLINT
|
||||
return 0.5f * (f * f * f - f * std::sin(f * kPi));
|
||||
}
|
||||
const float f = (1.f - (2.f * p - 1.f)); // NOLINT
|
||||
return 0.5f * (1.f - (f * f * f - f * std::sin(f * kPi))) + 0.5f; // NOLINT
|
||||
const float f = (1.f - (2.f * p - 1.f));
|
||||
return 0.5f * (1.f - (f * f * f - f * std::sin(f * kPi))) + 0.5f;
|
||||
}
|
||||
|
||||
float BounceIn(float p) {
|
||||
@@ -228,27 +225,26 @@ float BounceIn(float p) {
|
||||
}
|
||||
|
||||
float BounceOut(float p) {
|
||||
if (p < 4.f / 11.f) { // NOLINT
|
||||
return (121.f * p * p) / 16.f; // NOLINT
|
||||
if (p < 4.f / 11.f) {
|
||||
return (121.f * p * p) / 16.f;
|
||||
}
|
||||
|
||||
if (p < 8.f / 11.f) { // NOLINT
|
||||
return (363.f / 40.f * p * p) - (99.f / 10.f * p) + 17.f / 5.f; // NOLINT
|
||||
if (p < 8.f / 11.f) {
|
||||
return (363.f / 40.f * p * p) - (99.f / 10.f * p) + 17.f / 5.f;
|
||||
}
|
||||
|
||||
if (p < 9.f / 10.f) { // NOLINT
|
||||
return (4356.f / 361.f * p * p) - (35442.f / 1805.f * p) + // NOLINT
|
||||
16061.f / 1805.f; // NOLINT
|
||||
if (p < 9.f / 10.f) {
|
||||
return (4356.f / 361.f * p * p) - (35442.f / 1805.f * p) + 16061.f / 1805.f;
|
||||
}
|
||||
|
||||
return (54.f / 5.f * p * p) - (513 / 25.f * p) + 268 / 25.f; // NOLINT
|
||||
return (54.f / 5.f * p * p) - (513 / 25.f * p) + 268 / 25.f;
|
||||
}
|
||||
|
||||
float BounceInOut(float p) { // NOLINT
|
||||
if (p < 0.5f) { // NOLINT
|
||||
return 0.5f * BounceIn(p * 2.f); // NOLINT
|
||||
float BounceInOut(float p) {
|
||||
if (p < 0.5f) {
|
||||
return 0.5f * BounceIn(p * 2.f);
|
||||
}
|
||||
return 0.5f * BounceOut(p * 2.f - 1.f) + 0.5f; // NOLINT
|
||||
return 0.5f * BounceOut(p * 2.f - 1.f) + 0.5f;
|
||||
}
|
||||
|
||||
} // namespace easing
|
||||
@@ -278,11 +274,12 @@ void Animator::OnAnimation(Params& params) {
|
||||
if (current_ <= Duration()) {
|
||||
*value_ = from_;
|
||||
} else {
|
||||
*value_ = from_ +
|
||||
(to_ - from_) * easing_function_(current_ / duration_); // NOLINT
|
||||
*value_ = from_ + (to_ - from_) * easing_function_(current_ / duration_);
|
||||
}
|
||||
|
||||
RequestAnimationFrame();
|
||||
}
|
||||
|
||||
} // namespace ftxui::animation
|
||||
|
||||
// NOLINTEND(*-magic-numbers)
|
||||
|
@@ -7,7 +7,7 @@
|
||||
namespace ftxui {
|
||||
|
||||
TEST(AnimationTest, StartAndEnd) {
|
||||
std::vector<animation::easing::Function> functions = {
|
||||
const std::vector<animation::easing::Function> functions = {
|
||||
animation::easing::Linear, animation::easing::QuadraticIn,
|
||||
animation::easing::QuadraticOut, animation::easing::QuadraticInOut,
|
||||
animation::easing::CubicIn, animation::easing::CubicOut,
|
||||
@@ -25,7 +25,7 @@ TEST(AnimationTest, StartAndEnd) {
|
||||
animation::easing::BounceIn, animation::easing::BounceOut,
|
||||
animation::easing::BounceInOut,
|
||||
};
|
||||
for (auto& it : functions) {
|
||||
for (const auto& it : functions) {
|
||||
EXPECT_NEAR(0.F, it(0.F), 1.0e-4);
|
||||
EXPECT_NEAR(1.F, it(1.F), 1.0e-4);
|
||||
}
|
||||
|
@@ -74,7 +74,7 @@ Component Button(ConstStringRef label,
|
||||
const bool focused = Focused();
|
||||
const bool focused_or_hover = focused || mouse_hover_;
|
||||
|
||||
float target = focused_or_hover ? 1.F : 0.F; // NOLINT
|
||||
float target = focused_or_hover ? 1.f : 0.f; // NOLINT
|
||||
if (target != animator_background_.to()) {
|
||||
SetAnimationTarget(target);
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#include "ftxui/screen/screen.hpp" // for Screen
|
||||
#include "ftxui/screen/terminal.hpp" // for SetColorSupport, Color, TrueColor
|
||||
|
||||
// NOLINTBEGIN
|
||||
namespace ftxui {
|
||||
|
||||
namespace {
|
||||
@@ -189,6 +190,7 @@ TEST(ButtonTest, Animation) {
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
// NOLINTEND
|
||||
|
||||
// Copyright 2022 Arthur Sonzogni. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be found in
|
||||
|
@@ -8,6 +8,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/screen.hpp" // for Screen
|
||||
|
||||
// NOLINTBEGIN
|
||||
namespace ftxui {
|
||||
|
||||
TEST(CollapsibleTest, Basic) {
|
||||
@@ -47,6 +48,7 @@ TEST(CollapsibleTest, Basic) {
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
// NOLINTEND
|
||||
|
||||
// Copyright 2022 Arthur Sonzogni. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be found in
|
||||
|
@@ -44,13 +44,13 @@ class ContainerBase : public ComponentBase {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return children_[*selector_ % children_.size()];
|
||||
return children_[static_cast<size_t>(*selector_) % children_.size()];
|
||||
}
|
||||
|
||||
void SetActiveChild(ComponentBase* child) override {
|
||||
for (size_t i = 0; i < children_.size(); ++i) {
|
||||
if (children_[i].get() == child) {
|
||||
*selector_ = (int)i;
|
||||
*selector_ = static_cast<int>(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ class ContainerBase : public ComponentBase {
|
||||
int* selector_ = nullptr;
|
||||
|
||||
void MoveSelector(int dir) {
|
||||
for (int i = *selector_ + dir; i >= 0 && i < (int)children_.size();
|
||||
for (int i = *selector_ + dir; i >= 0 && i < int(children_.size());
|
||||
i += dir) {
|
||||
if (children_[i]->Focusable()) {
|
||||
*selector_ = i;
|
||||
@@ -85,7 +85,7 @@ class ContainerBase : public ComponentBase {
|
||||
const size_t i = ((size_t(*selector_ + offset * dir + children_.size())) %
|
||||
children_.size());
|
||||
if (children_[i]->Focusable()) {
|
||||
*selector_ = (int)i;
|
||||
*selector_ = int(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -225,7 +225,7 @@ class TabContainer : public ContainerBase {
|
||||
if (children_.empty()) {
|
||||
return false;
|
||||
}
|
||||
return children_[*selector_ % children_.size()]->Focusable();
|
||||
return children_[size_t(*selector_) % children_.size()]->Focusable();
|
||||
}
|
||||
|
||||
bool OnMouseEvent(Event event) override {
|
||||
|
@@ -1,12 +1,13 @@
|
||||
#include <algorithm> // for max, min
|
||||
#include <cstddef> // for size_t
|
||||
#include <functional> // for function
|
||||
#include <memory> // for __shared_ptr_access, shared_ptr, allocator
|
||||
#include <memory> // for __shared_ptr_access, allocator, shared_ptr
|
||||
#include <string> // for string
|
||||
|
||||
#include "ftxui/component/component.hpp" // for Maybe, Checkbox, Make, Radiobox, Vertical, Dropdown
|
||||
#include "ftxui/component/component_base.hpp" // for Component, ComponentBase
|
||||
#include "ftxui/component/component_options.hpp" // for CheckboxOption, EntryState
|
||||
#include "ftxui/dom/elements.hpp" // for operator|, Element, border, filler, operator|=, separator, size, text, vbox, frame, vscroll_indicator, hbox, HEIGHT, LESS_THAN, bold, inverted
|
||||
#include "ftxui/screen/util.hpp" // for clamp
|
||||
#include "ftxui/util/ref.hpp" // for ConstStringListRef
|
||||
|
||||
namespace ftxui {
|
||||
@@ -38,8 +39,8 @@ Component Dropdown(ConstStringListRef entries, int* selected) {
|
||||
}
|
||||
|
||||
Element Render() override {
|
||||
*selected_ = std::min((int)entries_.size() - 1, std::max(0, *selected_));
|
||||
title_ = entries_[*selected_];
|
||||
*selected_ = util::clamp(*selected_, 0, (int)entries_.size() - 1);
|
||||
title_ = entries_[static_cast<size_t>(*selected_)];
|
||||
if (show_) {
|
||||
const int max_height = 12;
|
||||
return vbox({
|
||||
|
@@ -29,7 +29,7 @@ Event Event::Mouse(std::string input, struct Mouse mouse) {
|
||||
Event event;
|
||||
event.input_ = std::move(input);
|
||||
event.type_ = Type::Mouse;
|
||||
event.mouse_ = mouse; // NOLINT
|
||||
event.data_.mouse = mouse; // NOLINT
|
||||
return event;
|
||||
}
|
||||
|
||||
@@ -45,8 +45,7 @@ Event Event::CursorReporting(std::string input, int x, int y) {
|
||||
Event event;
|
||||
event.input_ = std::move(input);
|
||||
event.type_ = Type::CursorReporting;
|
||||
event.cursor_.x = x; // NOLINT
|
||||
event.cursor_.y = y; // NOLINT
|
||||
event.data_.cursor = {x, y}; // NOLINT
|
||||
return event;
|
||||
}
|
||||
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/screen.hpp" // for Screen
|
||||
|
||||
// NOLINTBEGIN
|
||||
namespace ftxui {
|
||||
|
||||
namespace {
|
||||
@@ -186,6 +187,7 @@ TEST(HoverableTest, Coverage) {
|
||||
|
||||
} // namespace
|
||||
} // namespace ftxui
|
||||
// NOLINTEND
|
||||
|
||||
// Copyright 2021 Arthur Sonzogni. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be found in
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include "ftxui/screen/screen.hpp" // for Fixed, Screen, Pixel
|
||||
#include "ftxui/util/ref.hpp" // for Ref
|
||||
|
||||
// NOLINTBEGIN
|
||||
namespace ftxui {
|
||||
|
||||
TEST(InputTest, Init) {
|
||||
@@ -488,6 +489,7 @@ TEST(InputTest, CtrlArrowRight2) {
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
// NOLINTEND
|
||||
|
||||
// Copyright 2021 Arthur Sonzogni. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be found in
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#include "ftxui/screen/screen.hpp" // for Screen
|
||||
#include "ftxui/util/ref.hpp" // for Ref
|
||||
|
||||
// NOLINTBEGIN
|
||||
namespace ftxui {
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
@@ -233,6 +234,7 @@ TEST(MenuTest, AnimationsVertical) {
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
// NOLINTEND
|
||||
|
||||
// Copyright 2022 Arthur Sonzogni. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be found in
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/screen.hpp" // for Screen
|
||||
|
||||
// NOLINTBEGIN
|
||||
namespace ftxui {
|
||||
|
||||
TEST(ModalTest, Basic) {
|
||||
@@ -39,6 +40,7 @@ TEST(ModalTest, Basic) {
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
// NOLINTEND
|
||||
|
||||
// Copyright 2022 Arthur Sonzogni. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be found in
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include "ftxui/component/event.hpp" // for Event, Event::Return, Event::ArrowDown, Event::End, Event::Home, Event::Tab, Event::TabReverse, Event::PageDown, Event::PageUp, Event::ArrowUp
|
||||
#include "ftxui/util/ref.hpp" // for Ref
|
||||
|
||||
// NOLINTBEGIN
|
||||
namespace ftxui {
|
||||
|
||||
TEST(RadioboxTest, NavigationArrow) {
|
||||
@@ -303,6 +304,7 @@ TEST(RadioboxTest, RemoveEntries) {
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
// NOLINTEND
|
||||
|
||||
// Copyright 2020 Arthur Sonzogni. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be found in
|
||||
|
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "ftxui/component/receiver.hpp"
|
||||
|
||||
// NOLINTBEGIN
|
||||
namespace ftxui {
|
||||
|
||||
TEST(Receiver, Basic) {
|
||||
@@ -74,6 +75,7 @@ TEST(Receiver, BasicWithThread) {
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
// NOLINTEND
|
||||
|
||||
// Copyright 2020 Arthur Sonzogni. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be found in
|
||||
|
@@ -18,7 +18,7 @@ namespace {
|
||||
|
||||
class ResizableSplitBase : public ComponentBase {
|
||||
public:
|
||||
ResizableSplitBase(ResizableSplitOption options)
|
||||
explicit ResizableSplitBase(ResizableSplitOption options)
|
||||
: options_(std::move(options)) {
|
||||
Add(Container::Horizontal({
|
||||
options_->main,
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/screen.hpp" // for Screen
|
||||
|
||||
// NOLINTBEGIN
|
||||
namespace ftxui {
|
||||
|
||||
namespace {
|
||||
@@ -203,6 +204,7 @@ TEST(ResizableSplit, BasicBottomWithCustomSeparator) {
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
// NOLINTEND
|
||||
|
||||
// Copyright 2022 Arthur Sonzogni. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be found in
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <gtest/gtest.h> // for Test, TestInfo (ptr only), TEST, EXPECT_EQ, Message, TestPartResult
|
||||
#include <csignal> // for raise, SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, SIGTERM
|
||||
#include <ftxui/component/event.hpp> // for Event, Event::Custom
|
||||
#include <tuple> // for _Swallow_assign, ignore
|
||||
|
||||
#include "ftxui/component/component.hpp" // for Renderer
|
||||
#include "ftxui/component/screen_interactive.hpp"
|
||||
@@ -14,7 +15,7 @@ bool TestSignal(int signal) {
|
||||
// The tree of components. This defines how to navigate using the keyboard.
|
||||
auto component = Renderer([&] {
|
||||
called++;
|
||||
std::raise(signal);
|
||||
std::ignore = std::raise(signal);
|
||||
called++;
|
||||
return text("");
|
||||
});
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include <gtest/gtest.h> // for AssertionResult, Message, TestPartResult, Test, EXPECT_EQ, EXPECT_TRUE, TestInfo (ptr only), EXPECT_FALSE, TEST
|
||||
#include <stddef.h> // for size_t
|
||||
#include <array> // for array
|
||||
#include <cstddef> // for size_t
|
||||
#include <ftxui/component/mouse.hpp> // for Mouse, Mouse::Left, Mouse::Pressed, Mouse::Released
|
||||
#include <ftxui/dom/direction.hpp> // for Direction, Direction::Down, Direction::Left, Direction::Right, Direction::Up
|
||||
#include <ftxui/dom/elements.hpp> // for frame
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "ftxui/dom/node.hpp" // for Render
|
||||
#include "ftxui/screen/screen.hpp" // for Screen
|
||||
|
||||
// NOLINTBEGIN
|
||||
namespace ftxui {
|
||||
|
||||
namespace {
|
||||
@@ -187,6 +188,7 @@ TEST(SliderTest, Focus) {
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
// NOLINTEND
|
||||
|
||||
// Copyright 2022 Arthur Sonzogni. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be found in
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include "ftxui/component/receiver.hpp" // for MakeReceiver, ReceiverImpl
|
||||
#include "ftxui/component/terminal_input_parser.hpp"
|
||||
|
||||
// NOLINTBEGIN
|
||||
namespace ftxui {
|
||||
|
||||
// Test char |c| to are trivially converted into |Event::Character(c)|.
|
||||
@@ -384,6 +385,7 @@ TEST(Event, Special) {
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
// NOLINTEND
|
||||
|
||||
// Copyright 2020 Arthur Sonzogni. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be found in
|
||||
|
@@ -1,17 +1,17 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <functional> // for function
|
||||
#include <memory> // for __shared_ptr_access, shared_ptr, allocator
|
||||
#include <string> // for string, basic_string
|
||||
#include <vector> // for vector
|
||||
#include <gtest/gtest.h> // for AssertionResult, Message, TestPartResult, EXPECT_EQ, Test, EXPECT_TRUE, TestInfo (ptr only), EXPECT_FALSE, TEST
|
||||
#include <functional> // for function
|
||||
#include <memory> // for __shared_ptr_access, shared_ptr, allocator
|
||||
#include <string> // for string, basic_string
|
||||
#include <vector> // for vector
|
||||
|
||||
#include "ftxui/component/captured_mouse.hpp" // for ftxui
|
||||
#include "ftxui/component/component.hpp" // for Toggle
|
||||
#include "ftxui/component/component.hpp" // for Menu, Toggle
|
||||
#include "ftxui/component/component_base.hpp" // for ComponentBase
|
||||
#include "ftxui/component/component_options.hpp" // for ToggleOption
|
||||
#include "ftxui/component/component_options.hpp" // for MenuOption
|
||||
#include "ftxui/component/event.hpp" // for Event, Event::ArrowLeft, Event::ArrowRight, Event::Return, Event::Tab, Event::TabReverse
|
||||
#include "ftxui/util/ref.hpp" // for Ref
|
||||
|
||||
using namespace ftxui;
|
||||
// NOLINTBEGIN
|
||||
namespace ftxui {
|
||||
|
||||
TEST(ToggleTest, leftRightArrow) {
|
||||
std::vector<std::string> entries = {"On", "Off"};
|
||||
@@ -177,6 +177,9 @@ TEST(ToggleTest, RemoveEntries) {
|
||||
EXPECT_EQ(focused_entry, 1);
|
||||
}
|
||||
|
||||
} // namespace ftxui
|
||||
// NOLINTEND
|
||||
|
||||
// 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