Bug 775852 followup: skip the test when WebGL is not around. No review.

This commit is contained in:
Boris Zbarsky 2012-07-31 10:24:01 -04:00
parent a83632d011
commit 935cb6af8f

View File

@ -19,32 +19,41 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=775852
<script type="application/javascript">
/** Test for Bug 775852 **/
var gl = $("c").getContext("experimental-webgl");
var setterCalled = false;
function doTest() {
try {
var gl = $("c").getContext("experimental-webgl");
} catch (e) {
// No WebGL support on MacOS 10.5. Just skip this test
todo(false, "WebGL not supported");
return;
}
var setterCalled = false;
extLength = gl.getSupportedExtensions().length;
ok(extLength > 0,
"This test won't work right if we have no supported extensions");
extLength = gl.getSupportedExtensions().length;
ok(extLength > 0,
"This test won't work right if we have no supported extensions");
Object.defineProperty(Array.prototype, "0",
{
set: function(val) {
setterCalled = true;
}
});
Object.defineProperty(Array.prototype, "0",
{
set: function(val) {
setterCalled = true;
}
});
// Test that our property got defined correctly
var arr = []
arr[0] = 5;
is(setterCalled, true, "Setter should be called when setting prop on array");
// Test that our property got defined correctly
var arr = []
arr[0] = 5;
is(setterCalled, true, "Setter should be called when setting prop on array");
setterCalled = false;
setterCalled = false;
is(gl.getSupportedExtensions().length, extLength,
"We should still have the same number of extensions");
is(gl.getSupportedExtensions().length, extLength,
"We should still have the same number of extensions");
is(setterCalled, false,
"Setter should not be called when getting supported extensions");
is(setterCalled, false,
"Setter should not be called when getting supported extensions");
}
doTest();
</script>
</pre>
</body>