gecko/content/canvas/test/webgl/conformance/context-attributes.html

67 lines
2.5 KiB
HTML

<!--
Copyright (c) 2010 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<html>
<head>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description("Test passing down and fetching of WebGLContextAttributes");
debug("Test default values");
var context;
var attribs;
shouldBeNonNull("context = create3DContext(null)");
shouldBeNonNull("attribs = context.getContextAttributes()");
shouldBe("attribs.depth", "true");
shouldBe("attribs.alpha", "true");
shouldBe("attribs.stencil", "false");
// Antialias is requested by default, but might or might not be supported.
shouldBe("attribs.antialias == true || attribs.antialias == false", "true");
shouldBe("attribs.premultipliedAlpha", "true");
debug ("Test customized values");
shouldBeNonNull("context = create3DContext(null, { stencil: false, antialias: false })");
shouldBeNonNull("attribs = context.getContextAttributes()");
shouldBe("attribs.depth", "true");
shouldBe("attribs.alpha", "true");
shouldBe("attribs.stencil", "false");
shouldBe("attribs.antialias", "false");
shouldBe("attribs.premultipliedAlpha", "true");
debug("Test customized values");
// (stencil == true && depth == false) is not supported.
// Default depth to true if EXT_packed_depth_stencil is supported.
// Otherwise, both depth and stencil should be false.
shouldBeNonNull("context = create3DContext(null, { depth: false, stencil: true, antialias: false })");
shouldBeNonNull("attribs = context.getContextAttributes()");
shouldBe("attribs.depth == attribs.stencil", "true");
shouldBe("attribs.alpha", "true");
shouldBe("attribs.antialias", "false");
shouldBe("attribs.premultipliedAlpha", "true");
debug("Test customized values");
// (premultipliedAlpha == false) is not supported by most implementations yet
shouldBeNonNull("context = create3DContext(null, { premultipliedAlpha: false, antialias: false })");
shouldBeNonNull("attribs = context.getContextAttributes()");
shouldBe("attribs.depth", "true");
shouldBe("attribs.alpha", "true");
shouldBe("attribs.stencil == true || attribs.stencil == false", "true");
shouldBe("attribs.antialias", "false");
shouldBe("attribs.premultipliedAlpha == true || attribs.premultipliedAlpha == false", "true");
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>