OLD | NEW |
(Empty) | |
| 1 Tests for the WebGL canvas context |
| 2 ================================== |
| 3 |
| 4 These tests are intended to serve the following purposes: |
| 5 |
| 6 * Assert spec conformance |
| 7 * Check the safety of the GL binding (bounds checking, same origin policy) |
| 8 * Provide performance numbers for developers |
| 9 |
| 10 |
| 11 Running the tests |
| 12 ----------------- |
| 13 |
| 14 1. <a href="http://learningwebgl.com/blog/?p=11">Install a browser with WebGL
support</a> |
| 15 2. Run <code>ruby gen_tests.rb</code> if you have modified the tests. |
| 16 3. Run <code>ruby test_server.rb</code> if you want to get test run output to
test_server's stdout (especially useful for finding out which test crashed your
browser.) |
| 17 4. Open all_tests.html in your browser. |
| 18 |
| 19 |
| 20 Want to contribute? |
| 21 ------------------- |
| 22 |
| 23 1. Fork this repo |
| 24 2. Run <code>gen_tests.rb</code> |
| 25 3. Look into templates/ to see which functions lack tests (also see <a href=".
./raw/master/methods.txt">methods.txt</a> and <a href="http://mxr.mozilla.org/mo
zilla-central/source/dom/interfaces/canvas/nsICanvasRenderingContextWebGL.idl">n
sICanvasRenderingContextWebGL.idl</a>): |
| 26 1. copy methodName.html to functions/methodName.html and write tests that te
st the results of valid inputs. |
| 27 2. copy methodNameBadArgs.html to functions/methodNameBadArgs.html and write
tests to assert that invalid inputs throw exceptions. |
| 28 3. If your test causes a segfault, add the following to the top of the scrip
t tag: <code>Tests.autorun = false; Tests.message = "Caution: this may crash you
r browser";</code> |
| 29 4. For each performance test: |
| 30 1. Write a performance/myTestName.html and set <code>Tests.autorun = false;<
/code> |
| 31 5. If you have a test that you would like to run over the whole API or want to
generate tests programmatically, add them to gen_tests.rb or write your own scr
ipt. |
| 32 6. Create a commit for each file. (E.g. <code>for f in $(git status | grep -e
"^#\\s*functions/\\S*$" | sed "s/^#\s*//"); do git add $f; git commit -m $f; don
e</code>) |
| 33 7. Send me a pull request. |
| 34 8. Congratulations, you're now a contributor! |
| 35 |
| 36 |
| 37 For more information on WebGL: |
| 38 |
| 39 * <a href="http://planet-webgl.org">Planet WebGL</a> |
| 40 * <a href="http://learningwebgl.com">Learning WebGL</a> |
| 41 * <a href="http://www.khronos.org/message_boards/viewforum.php?f=34">WebGL on
Khronos Message Boards</a> |
| 42 |
| 43 Developer links: |
| 44 |
| 45 * <a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=webgl">WebGL o
n Mozilla Bugzilla</a> |
| 46 * <a href="https://bugzilla.webkit.org/buglist.cgi?quicksearch=webgl">WebGL on
WebKit Bugzilla</a> |
| 47 * <a href="http://code.google.com/p/chromium/issues/list?q=label:3D-WebGL">Web
GL on Chromium Bugzilla</a> |
| 48 |
| 49 What's the stuff in apigen? |
| 50 |
| 51 There are some Python scripts in the apigen/ directory that generate C++ based
on the API definition files (gl2.h, api_modifications.txt, valid_args.txt.) The
generated code is Mozilla XPCOM functions that check their args against the val
id GLES 2.0 constants (as they were written on the man pages.) There's also some
wackier stuff for checking copyTexImage2D and copyTexSubImage2D image dimension
s against viewport dimensions. |
| 52 |
| 53 If you can use it to generate code for your WebGL implementation, it might sav
e you 1500 lines of typing and testing. The last time I used it was summer 2009
to generate a patch for Canvas 3D, so it's likely somewhat out of date. |
OLD | NEW |