summaryrefslogtreecommitdiff
path: root/dev
diff options
context:
space:
mode:
Diffstat (limited to 'dev')
-rw-r--r--dev/gui/gui.zig9
1 files changed, 8 insertions, 1 deletions
diff --git a/dev/gui/gui.zig b/dev/gui/gui.zig
index 9ea813fc..aba74a94 100644
--- a/dev/gui/gui.zig
+++ b/dev/gui/gui.zig
@@ -3904,7 +3904,7 @@ fn imageScissor(g: *const Gui, place: pardes.Placement) c.SDL_Rect {
return .{
.x = @intCast(@as(u32, place.dst.x) * g.cell_w),
.y = @intCast(@as(u32, place.dst.y) * g.cell_h),
- .w = @intCast(@as(u32, place.dst.w) * g.cell_w + 100000), // THROWAWAY: past any target
+ .w = @intCast(@as(u32, place.dst.w) * g.cell_w),
.h = @intCast(@as(u32, place.dst.h) * g.cell_h),
};
}
@@ -7010,6 +7010,13 @@ test "a held key moves the view at the stream's own rate, never a bounce a line,
for (70..90) |k| try std.testing.expectEqual(held.carets[70], held.carets[k]);
}
+test "a picture's scissor is its placement's cells, cut at its pane's edges" {
+ const g = testGui(10, 20, 6, 12);
+ var place: pardes.Placement = undefined;
+ place.dst = .{ .x = 2, .y = 3, .w = 4, .h = 5 };
+ try std.testing.expectEqual(c.SDL_Rect{ .x = 20, .y = 60, .w = 40, .h = 100 }, imageScissor(&g, place));
+}
+
test "a scroll's shifted rows start under the context rows, and its scissor below their band" {
var surface: pardes.Surface = .{};
var g = testGui(10, 20, 6, 12);