Index: LayoutTests/webgl/resources/webgl_test_files/conformance/context/constants-and-properties.html |
diff --git a/LayoutTests/fast/canvas/webgl/constants.html b/LayoutTests/webgl/resources/webgl_test_files/conformance/context/constants-and-properties.html |
similarity index 85% |
rename from LayoutTests/fast/canvas/webgl/constants.html |
rename to LayoutTests/webgl/resources/webgl_test_files/conformance/context/constants-and-properties.html |
index 8b6bc94bf6456813f1aa3c085377b928b7f63405..37ef22aeb08f15bd73f5ab2a1e9bf7ed1c181e73 100644 |
--- a/LayoutTests/fast/canvas/webgl/constants.html |
+++ b/LayoutTests/webgl/resources/webgl_test_files/conformance/context/constants-and-properties.html |
@@ -1,22 +1,47 @@ |
-<html> |
-<head> |
<!-- |
-Copyright (c) 2009 Ilmari Heikkinen. All rights reserved. |
-Use of this source code is governed by a BSD-style license that can be |
-found in the LICENSE file. |
+ |
+/* |
+** Copyright (c) 2012 The Khronos Group Inc. |
+** |
+** Permission is hereby granted, free of charge, to any person obtaining a |
+** copy of this software and/or associated documentation files (the |
+** "Materials"), to deal in the Materials without restriction, including |
+** without limitation the rights to use, copy, modify, merge, publish, |
+** distribute, sublicense, and/or sell copies of the Materials, and to |
+** permit persons to whom the Materials are furnished to do so, subject to |
+** the following conditions: |
+** |
+** The above copyright notice and this permission notice shall be included |
+** in all copies or substantial portions of the Materials. |
+** |
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. |
+*/ |
+ |
--> |
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
-<title>WebGL Constants Test</title> |
-<script src="resources/desktop-gl-constants.js" type="text/javascript"></script> |
-<script src="../../js/resources/js-test-pre.js"></script> |
-<script src="resources/webgl-test.js"></script> |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<meta charset="utf-8"> |
+<title>WebGL Constants and Properties Test</title> |
+<link rel="stylesheet" href="../../resources/js-test-style.css"/> |
+<script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script> |
+<script src="../../resources/js-test-pre.js"></script> |
+<script src="../resources/webgl-test.js"></script> |
+<script src="../resources/webgl-test-utils.js"></script> |
</head> |
<body> |
<div id="description"></div> |
<div id="console"></div> |
<canvas id="canvas" style="width: 50px; height: 50px;"> </canvas> |
<script> |
-description("This test ensures that the WebGL context has all the constants in the specification."); |
+"use strict"; |
+description("This test ensures that the WebGL context has all the constants and (non-function) properties in the specification."); |
var constants = { |
/* ClearBufferMask */ |
@@ -212,7 +237,6 @@ UNSIGNED_SHORT : 0x1403, |
INT : 0x1404, |
UNSIGNED_INT : 0x1405, |
FLOAT : 0x1406, |
-HALF_FLOAT_OES : 0x8D61, |
/* PixelFormat */ |
DEPTH_COMPONENT : 0x1902, |
@@ -436,6 +460,19 @@ UNPACK_COLORSPACE_CONVERSION_WEBGL : 0x9243, |
BROWSER_DEFAULT_WEBGL : 0x9244 |
}; |
+// Other non-function properties on the WebGL object |
+var otherProperties = { |
+drawingBufferWidth : "number", |
+drawingBufferHeight : "number", |
+canvas : "implementation-dependent" |
+}; |
+ |
+// Properties to be ignored (as a list of strings) because they were |
+// added in versions of the spec that are backward-compatible with |
+// this version |
+var ignoredProperties = [ |
+]; |
+ |
// Constants removed from the WebGL spec compared to ES 2.0 |
var removedConstants = { |
NUM_COMPRESSED_TEXTURE_FORMATS : 0x86A2, |
@@ -478,7 +515,8 @@ debug(""); |
debug("Canvas.getContext"); |
var canvas = document.getElementById("canvas"); |
-var gl = create3DContext(canvas); |
+var wtu = WebGLTestUtils; |
+var gl = wtu.create3DContext(canvas); |
var passed = true; |
for (var i in constants) { |
var r = assertProperty(gl, i) && assertMsg_(gl[i] == constants[i], "Property "+i+" value test "+gl[i]+" == "+constants[i]); |
@@ -497,18 +535,30 @@ if (passed) { |
} |
var extended = false; |
for (var i in gl) { |
- if (i.match(/^[^a-z]/) && constants[i] == null) { |
+ if (constants[i] !== undefined) { |
+ // OK; known constant |
+ } else if (ignoredProperties.indexOf(i) != -1) { |
+ // OK; constant that should be ignored because it was added in a later version of the spec |
+ } else if (otherProperties[i] !== undefined && |
+ (otherProperties[i] == "implementation-dependent" || typeof gl[i] == otherProperties[i])) { |
+ // OK; known property of known type |
+ } else if (typeof gl[i] != "function") { |
if (!extended) { |
extended = true; |
- debug("Also found the following extra constants:"); |
+ testFailed("Also found the following extra properties:"); |
} |
- debug(i); |
+ testFailed(i); |
} |
} |
+if (!extended) { |
+ testPassed("No extra properties found on WebGL context."); |
+} |
+ |
debug(""); |
+var successfullyParsed = true; |
</script> |
-<script src="../../js/resources/js-test-post.js"></script> |
+<script src="../../resources/js-test-post.js"></script> |
</body> |
</html> |