mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-14 23:38:57 +00:00
update CanvasRenderingContext2D test
Adds the missing RGBA and long digit hex format tests.
This commit is contained in:
@@ -1,11 +1,12 @@
|
|||||||
//! Canvas API.
|
//! Canvas API.
|
||||||
//! https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API
|
//! https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API
|
||||||
|
|
||||||
|
const CanvasRenderingContext2D = @import("CanvasRenderingContext2D.zig");
|
||||||
const WebGLRenderingContext = @import("WebGLRenderingContext.zig");
|
const WebGLRenderingContext = @import("WebGLRenderingContext.zig");
|
||||||
const ExtensionType = WebGLRenderingContext.Extension.Type;
|
const Extension = WebGLRenderingContext.Extension;
|
||||||
|
|
||||||
pub const Interfaces = .{
|
pub const Interfaces = .{
|
||||||
@import("CanvasRenderingContext2D.zig"),
|
CanvasRenderingContext2D,
|
||||||
WebGLRenderingContext,
|
WebGLRenderingContext,
|
||||||
ExtensionType.WEBGL_debug_renderer_info,
|
Extension.Type.WEBGL_debug_renderer_info,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<script src="../testing.js"></script>
|
<script src="../testing.js"></script>
|
||||||
|
|
||||||
<script id=canvas>
|
<script id=CanvasRenderingContext2D>
|
||||||
{
|
{
|
||||||
const element = document.createElement("canvas");
|
const element = document.createElement("canvas");
|
||||||
const ctx = element.getContext("2d");
|
const ctx = element.getContext("2d");
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script id=canvas#fillStyle>
|
<script id=CanvasRenderingContext2D#fillStyle>
|
||||||
{
|
{
|
||||||
const element = document.createElement("canvas");
|
const element = document.createElement("canvas");
|
||||||
const ctx = element.getContext("2d");
|
const ctx = element.getContext("2d");
|
||||||
@@ -25,6 +25,12 @@
|
|||||||
// No changes made if color is invalid.
|
// No changes made if color is invalid.
|
||||||
ctx.fillStyle = "invalid-color";
|
ctx.fillStyle = "invalid-color";
|
||||||
testing.expectEqual(ctx.fillStyle, "#663399");
|
testing.expectEqual(ctx.fillStyle, "#663399");
|
||||||
|
ctx.fillStyle = "#fc0";
|
||||||
|
testing.expectEqual(ctx.fillStyle, "#ffcc00");
|
||||||
|
ctx.fillStyle = "#ff0000";
|
||||||
|
testing.expectEqual(ctx.fillStyle, "#ff0000");
|
||||||
|
ctx.fillStyle = "#fF00000F";
|
||||||
|
testing.expectEqual(ctx.fillStyle, "rgba(255, 0, 0, 0.06)");
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user