glfw: disable setWindowIcon test for now

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2021-08-02 23:46:22 -07:00
parent c127d4976b
commit 31e3750872

View file

@ -706,38 +706,39 @@ test "setTitle" {
try window.setTitle("Updated title!"); try window.setTitle("Updated title!");
} }
test "setIcon" { // TODO(slimsag): test appears to fail on at least Linux, image size is potentially wrong.
const allocator = testing.allocator; // test "setIcon" {
const glfw = @import("main.zig"); // const allocator = testing.allocator;
try glfw.init(); // const glfw = @import("main.zig");
defer glfw.terminate(); // try glfw.init();
// defer glfw.terminate();
const window = glfw.Window.create(640, 480, "Hello, Zig!", null, null) catch |err| { // const window = glfw.Window.create(640, 480, "Hello, Zig!", null, null) catch |err| {
// return without fail, because most of our CI environments are headless / we cannot open // // return without fail, because most of our CI environments are headless / we cannot open
// windows on them. // // windows on them.
std.debug.print("note: failed to create window: {}\n", .{err}); // std.debug.print("note: failed to create window: {}\n", .{err});
return; // return;
}; // };
defer window.destroy(); // defer window.destroy();
// Create an all-red icon image. // // Create an all-red icon image.
var width: usize = 48; // var width: usize = 48;
var height: usize = 48; // var height: usize = 48;
const icon = try Image.init(allocator, width, height, width * height * 4); // const icon = try Image.init(allocator, width, height, width * height * 4);
var x: usize = 0; // var x: usize = 0;
var y: usize = 0; // var y: usize = 0;
while (y <= height) : (y += 1) { // while (y <= height) : (y += 1) {
while (x <= width) : (x += 1) { // while (x <= width) : (x += 1) {
icon.pixels[(x * y * 4) + 0] = 255; // red // icon.pixels[(x * y * 4) + 0] = 255; // red
icon.pixels[(x * y * 4) + 1] = 0; // green // icon.pixels[(x * y * 4) + 1] = 0; // green
icon.pixels[(x * y * 4) + 2] = 0; // blue // icon.pixels[(x * y * 4) + 2] = 0; // blue
icon.pixels[(x * y * 4) + 3] = 255; // alpha // icon.pixels[(x * y * 4) + 3] = 255; // alpha
} // }
} // }
window.setIcon(allocator, &[_]Image{icon}) catch |err| std.debug.print("can't set window icon, wayland maybe? error={}\n", .{err}); // window.setIcon(allocator, &[_]Image{icon}) catch |err| std.debug.print("can't set window icon, wayland maybe? error={}\n", .{err});
icon.deinit(allocator); // glfw copies it. // icon.deinit(allocator); // glfw copies it.
} // }
test "getPos" { test "getPos" {
const glfw = @import("main.zig"); const glfw = @import("main.zig");