diff options
author | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-07 19:40:28 +0000 |
---|---|---|
committer | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-07 19:40:28 +0000 |
commit | a3f11bdf0707abf7910847849554bdbfecfac833 (patch) | |
tree | a3a03baf50819b2fe1d6d3dcea1cb78170ff59c3 /o3d/tests/selenium | |
parent | f6ba7a52d574814030ad2b2033a3a09ef94e0dbf (diff) | |
download | chromium_src-a3f11bdf0707abf7910847849554bdbfecfac833.zip chromium_src-a3f11bdf0707abf7910847849554bdbfecfac833.tar.gz chromium_src-a3f11bdf0707abf7910847849554bdbfecfac833.tar.bz2 |
This CL adds texture.getRect
Review URL: http://codereview.chromium.org/165118
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22765 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/tests/selenium')
-rw-r--r-- | o3d/tests/selenium/tests/texture-set-test.html | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/o3d/tests/selenium/tests/texture-set-test.html b/o3d/tests/selenium/tests/texture-set-test.html index 891a08d..b3c37be 100644 --- a/o3d/tests/selenium/tests/texture-set-test.html +++ b/o3d/tests/selenium/tests/texture-set-test.html @@ -278,10 +278,33 @@ function initStep2(clientElements) { } texture.setRect(0, tx, ty, 32, pixels); sampler.texture = texture; + if (tx == 0 && ty == 0) { + var texturePixels = texture.getRect(0, tx, ty, 32, 32); + if (texturePixels.length != pixels.length) { + reportResult(false, 'different length'); + return; + } + for (var ndx = 0; ndx < pixels.length; ++ndx) { + // because float<->half conversion is not perfect + var difference = Math.abs(pixels[ndx] - texturePixels[ndx]); + if (difference > 0.004) { + reportResult(false, 'pixels different by:' + difference); + return; + } + } + } } } } - window.g_testResult = true; // for selenium testing. + reportResult(true, ''); +} + +function reportResult(result, msg) { + o3djs.BROWSER_ONLY; + document.getElementById('result').innerHTML = result ? + '<font color="green">success</font>' : + '<font color="red">failure: ' + msg + '</font>'; + window.g_testResult = result; // for selenium testing. } </script> @@ -293,6 +316,7 @@ function initStep2(clientElements) { <!-- Start of O3D plugin --> <div id="o3d" style="width: 400px; height: 400px;"></div> <!-- End of O3D plugin --> +<div>Result: <span id="result"></span></div> <script type="test/o3deffect" id="texture_only"> /* * Copyright 2009, Google Inc. |