mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-22 10:40:00 +08:00
Swap incorrect width/height mapping (#409)
width and height were being set using the incorrect axes resulting in incorrect canvas dimensions Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
This commit is contained in:
parent
ed5b4cec49
commit
b63aa9e375
@ -10,6 +10,7 @@ current (development)
|
|||||||
- Bugfix: Fix the selected/focused area. It used to be 1 cell larger/longer than
|
- Bugfix: Fix the selected/focused area. It used to be 1 cell larger/longer than
|
||||||
requested
|
requested
|
||||||
- Bugfix: Forward the selected/focused area from the child in gridbox.
|
- Bugfix: Forward the selected/focused area from the child in gridbox.
|
||||||
|
- Bugfix: Fix incorrect Canvas computed dimensions.
|
||||||
|
|
||||||
### Screen
|
### Screen
|
||||||
- Feature: add `Box::Union(a,b) -> Box`
|
- Feature: add `Box::Union(a,b) -> Box`
|
||||||
|
@ -871,8 +871,8 @@ Element canvas(int width, int height, std::function<void(Canvas&)> fn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Render(Screen& screen) final {
|
void Render(Screen& screen) final {
|
||||||
int width = (box_.y_max - box_.y_min + 1) * 2;
|
int width = (box_.x_max - box_.x_min + 1) * 2;
|
||||||
int height = (box_.x_max - box_.x_min + 1) * 4;
|
int height = (box_.y_max - box_.y_min + 1) * 4;
|
||||||
canvas_ = Canvas(width, height);
|
canvas_ = Canvas(width, height);
|
||||||
fn_(canvas_);
|
fn_(canvas_);
|
||||||
CanvasNodeBase::Render(screen);
|
CanvasNodeBase::Render(screen);
|
||||||
|
@ -39,7 +39,7 @@ TEST(CanvasTest, GoldPoint) {
|
|||||||
});
|
});
|
||||||
Screen screen(30, 10);
|
Screen screen(30, 10);
|
||||||
Render(screen, element);
|
Render(screen, element);
|
||||||
EXPECT_EQ(Hash(screen.ToString()), -1195891837);
|
EXPECT_EQ(Hash(screen.ToString()), 2143518726);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CanvasTest, GoldPointColor) {
|
TEST(CanvasTest, GoldPointColor) {
|
||||||
@ -54,7 +54,7 @@ TEST(CanvasTest, GoldPointColor) {
|
|||||||
});
|
});
|
||||||
Screen screen(30, 10);
|
Screen screen(30, 10);
|
||||||
Render(screen, element);
|
Render(screen, element);
|
||||||
EXPECT_EQ(Hash(screen.ToString()), 1109533029);
|
EXPECT_EQ(Hash(screen.ToString()), 1264423298);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CanvasTest, GoldBlock) {
|
TEST(CanvasTest, GoldBlock) {
|
||||||
@ -72,7 +72,7 @@ TEST(CanvasTest, GoldBlock) {
|
|||||||
});
|
});
|
||||||
Screen screen(30, 10);
|
Screen screen(30, 10);
|
||||||
Render(screen, element);
|
Render(screen, element);
|
||||||
EXPECT_EQ(Hash(screen.ToString()), 817159424);
|
EXPECT_EQ(Hash(screen.ToString()), 3826174883);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CanvasTest, GoldBlockColor) {
|
TEST(CanvasTest, GoldBlockColor) {
|
||||||
@ -87,7 +87,7 @@ TEST(CanvasTest, GoldBlockColor) {
|
|||||||
});
|
});
|
||||||
Screen screen(30, 10);
|
Screen screen(30, 10);
|
||||||
Render(screen, element);
|
Render(screen, element);
|
||||||
EXPECT_EQ(Hash(screen.ToString()), 2869205941);
|
EXPECT_EQ(Hash(screen.ToString()), 3048712696);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CanvasTest, GoldText) {
|
TEST(CanvasTest, GoldText) {
|
||||||
|
Loading…
Reference in New Issue
Block a user