diff --git a/src/terminal/kitty/graphics_image.zig b/src/terminal/kitty/graphics_image.zig index 61f27055f..490f1ce19 100644 --- a/src/terminal/kitty/graphics_image.zig +++ b/src/terminal/kitty/graphics_image.zig @@ -175,9 +175,9 @@ pub const Image = struct { // Data length must be what we expect const expected_len = self.width * self.height * bpp; const actual_len = self.data.len; - std.log.warn( - "width={} height={} bpp={} expected_len={} actual_len={}", - .{ self.width, self.height, bpp, expected_len, actual_len }, + std.log.debug( + "complete image id={} width={} height={} bpp={} expected_len={} actual_len={}", + .{ self.id, self.width, self.height, bpp, expected_len, actual_len }, ); if (actual_len != expected_len) return error.InvalidData; } @@ -339,3 +339,30 @@ test "image load: rgb, zlib compressed, direct" { // should be decompressed try testing.expect(img.compression == .none); } + +test "image load: rgb, not compressed, direct" { + const testing = std.testing; + const alloc = testing.allocator; + + var cmd: command.Command = .{ + .control = .{ .transmit = .{ + .format = .rgb, + .medium = .direct, + .compression = .none, + .width = 20, + .height = 15, + .image_id = 31, + } }, + .data = try alloc.dupe( + u8, + @embedFile("testdata/image-rgb-none-20x15-2147483647.data"), + ), + }; + defer cmd.deinit(alloc); + var img = try Image.load(alloc, &cmd); + defer img.deinit(alloc); + try img.complete(alloc); + + // should be decompressed + try testing.expect(img.compression == .none); +} diff --git a/src/terminal/kitty/testdata/image-rgb-none-20x15-2147483647.data b/src/terminal/kitty/testdata/image-rgb-none-20x15-2147483647.data new file mode 100644 index 000000000..f65d40ce8 --- /dev/null +++ b/src/terminal/kitty/testdata/image-rgb-none-20x15-2147483647.data @@ -0,0 +1 @@ +DRoeCxgcCxcjEh4qDBgkCxcjChYiCxcjCRclBRMhBxIXHysvTVNRbHJwcXB2Li0zCBYXEyEiCxkaDBobChcbCBUZDxsnBBAcEBwoChYiCxcjDBgkDhwqBxUjDBccm6aqy9HP1NrYzs3UsK+2IjAxCBYXCBYXBxUWFBoaDxUVICYqIyktERcZDxUXDxUVEhgYDhUTCxIQGh8XusC4zM7FvL61q6elmZWTTVtcDBobD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