Merge pull request #2213 from rockorager/main

graphics: set default transmission format as .rgba
This commit is contained in:
Mitchell Hashimoto
2024-09-10 11:08:35 -07:00
committed by GitHub
2 changed files with 21 additions and 1 deletions

View File

@ -366,7 +366,7 @@ pub const Command = struct {
}; };
pub const Transmission = struct { pub const Transmission = struct {
format: Format = .rgb, // f format: Format = .rgba, // f
medium: Medium = .direct, // t medium: Medium = .direct, // t
width: u32 = 0, // s width: u32 = 0, // s
height: u32 = 0, // v height: u32 = 0, // v

View File

@ -475,3 +475,23 @@ test "kittygfx more chunks with chunk increasing q" {
try testing.expect(resp == null); try testing.expect(resp == null);
} }
} }
test "kittygfx default format is rgba" {
const testing = std.testing;
const alloc = testing.allocator;
var t = try Terminal.init(alloc, .{ .rows = 5, .cols = 5 });
defer t.deinit(alloc);
const cmd = try command.Parser.parseString(
alloc,
"a=t,t=d,i=1,s=1,v=2,c=10,r=1;///////////",
);
defer cmd.deinit(alloc);
const resp = execute(alloc, &t, &cmd).?;
try testing.expect(resp.ok());
const storage = &t.screen.kitty_images;
const img = storage.imageById(1).?;
try testing.expectEqual(command.Transmission.Format.rgba, img.format);
}