mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-14 15:28:57 +00:00
update canvas test
This commit is contained in:
@@ -2,10 +2,28 @@
|
||||
<script src="../testing.js"></script>
|
||||
|
||||
<script id=canvas>
|
||||
{
|
||||
const element = document.createElement("canvas");
|
||||
const ctx = element.getContext("2d");
|
||||
testing.expectEqual(true, ctx instanceof CanvasRenderingContext2D);
|
||||
// We can't really test this but let's try to call it.
|
||||
// We can't really test this but let's try to call it at least.
|
||||
ctx.fillRect(0, 0, 0, 0);
|
||||
testing.expectEqual("", ctx.fillStyle);
|
||||
}
|
||||
</script>
|
||||
|
||||
<script id=canvas#fillStyle>
|
||||
{
|
||||
const element = document.createElement("canvas");
|
||||
const ctx = element.getContext("2d");
|
||||
|
||||
// Black by default.
|
||||
testing.expectEqual(ctx.fillStyle, "#000000");
|
||||
ctx.fillStyle = "red";
|
||||
testing.expectEqual(ctx.fillStyle, "#ff0000");
|
||||
ctx.fillStyle = "rebeccapurple";
|
||||
testing.expectEqual(ctx.fillStyle, "#663399");
|
||||
// No changes made if color is invalid.
|
||||
ctx.fillStyle = "invalid-color";
|
||||
testing.expectEqual(ctx.fillStyle, "#663399");
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user