-
-
Notifications
You must be signed in to change notification settings - Fork 452
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix linear_gradient float precision bug.
This was reported by: #998 Indeed, the `t` interpolation factor, which is itself interpolated might become slightly larger than 1.0. This is due to the float precision. This was supposedly handled, but there was an off-by-one error in the check. Along the way, fix a bug found by a fuzzer. Bug: #998 Fixed: #998
- Loading branch information
1 parent
15587da
commit d75108e
Showing
6 changed files
with
48 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2025 Arthur Sonzogni. All rights reserved. | ||
// Use of this source code is governed by the MIT license that can be found in | ||
// the LICENSE file. | ||
|
||
#include "ftxui/component/component.hpp" // for Horizontal, Vertical, Button, Tab | ||
#include "ftxui/component/component_base.hpp" // for ComponentBase, Component | ||
#include "ftxui/component/event.hpp" // for Event, Event::Tab, Event::TabReverse, Event::ArrowDown, Event::ArrowLeft, Event::ArrowRight, Event::ArrowUp | ||
#include "gtest/gtest.h" // for AssertionResult, Message, TestPartResult, EXPECT_EQ, EXPECT_FALSE, Test, EXPECT_TRUE, TEST | ||
|
||
namespace ftxui { | ||
|
||
TEST(DropdownTest, Empty) { | ||
std::vector<std::string> list = {}; | ||
int index = 0; | ||
auto dropdown = Dropdown(list, &index); | ||
|
||
dropdown->OnEvent(Event::Return); | ||
|
||
auto screen = Screen(8, 8); | ||
auto document = dropdown->Render(); | ||
Render(screen, document); | ||
|
||
EXPECT_EQ(screen.ToString(), | ||
"╭──────╮\r\n" | ||
"│↓ │\r\n" | ||
"├──────┤\r\n" | ||
"│ │\r\n" | ||
"│ │\r\n" | ||
"│ │\r\n" | ||
"│ │\r\n" | ||
"╰──────╯"); | ||
} | ||
|
||
} // namespace ftxui |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters