Bug 782860 - Add basic WebGL reftests - r=bjacob
authorJeff Gilbert <jgilbert@mozilla.com>
Thu, 06 Sep 2012 18:46:39 -0700
changeset 104539 b95fb2e6e004dc801397da11d8b3ecf691a32278
parent 104538 76c080138e14638487465e9257fbb91269ddaa9d
child 104540 1d82814a300cb311968d4921504381fe5a5d65c1
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersbjacob
bugs782860
milestone18.0a1
Bug 782860 - Add basic WebGL reftests - r=bjacob
content/canvas/test/reftest/black.png
content/canvas/test/reftest/colors-half-alpha.png
content/canvas/test/reftest/colors.png
content/canvas/test/reftest/green.png
content/canvas/test/reftest/half-colors-half-alpha.png
content/canvas/test/reftest/half-colors.png
content/canvas/test/reftest/reftest.list
content/canvas/test/reftest/webgl-clear-test.html
content/canvas/test/reftest/webgl-color-alpha-test.html
content/canvas/test/reftest/webgl-color-test.html
content/canvas/test/reftest/webgl-disable-test.html
content/canvas/test/reftest/webgl-hanging-fb-test.html
content/canvas/test/reftest/webgl-hanging-scissor-test.html
content/canvas/test/reftest/webgl-orientation-test.html
content/canvas/test/reftest/webgl-utils.js
content/canvas/test/reftest/white-top-left.png
content/canvas/test/reftest/white.png
content/canvas/test/reftest/wrapper.html
content/test/reftest/reftest.list
image/test/reftest/bmp/bmp-corrupted/wrapper.html
new file mode 100644
index 0000000000000000000000000000000000000000..7e3e4b53747914a3eaf1a961a5b09945da0c0337
GIT binary patch
literal 1027
zc%17D@N?(olHy`uVBq!ia0y~yU}OMc4kjRVS-{>9#48SRcVbv~PUa<$!;<dk>&U>c
zv7h@-A}f&3S>O>_%)r2R7=#&*=dVZs3QCo@MwA5Sr<If^7Ns%-BxdH7==r&ZD3lrN
znd%uD7<?&O$iTo{<muuVQW5v|f+5JxLkqt8zfI-ta7aARz{t$TBVmv*${1ygGN{Hl
az|O{~%fOgmDp?84Zw#KUelF{r5}E)KeChH4
new file mode 100644
index 0000000000000000000000000000000000000000..e64729dedf2bb2f539fcc572541fbf4f7229d394
GIT binary patch
literal 1936
zc%17D@N?(olHy`uVBq!ia0y~yU}OMc4kjRVS-{>9NU@|l`Z_W&Z0zU$lgJ9>a~60+
z7BevL9RguSQ4OyKprBNVYeY$Kep*R+Vo@qXKw@TIiJqTph(ejMo~fRpfx(xeg$xYr
zJf1F&Ar*0NuWjUIHWWDGP`d8Y*ZW6VyboJ8+Ftrp`Tbif_m+LJ4-VXJ|0llTd4C+k
z4aT1N{{^)eaukk<ANa#`!=Y!seZ4+|nZRT2ggQo`==u5k#TleKKC&9@2Z=sEf1kU7
z_s9>X8Sx;|&(Ghp9$-tVVLYP`68-u4J5vI);Xa0E;y}?qe|}aoZfKN<XZXww6s`OB
zXD<WL0{w=ctUyuw`hRhw){a^`YAq4gZs)$h8YjQ&fF{FkhP`zk!Wn+}JMi6N<yye7
zrg26b18almmLE(S4A~0H#2pwDSatU?a2=59c*z>T5aHOZ-@vqiEvbr8gdyz0BkoZx
eqgqCU7Wt5iic{7XFnk8qo(!I@elF{r5}E+jH|F60
new file mode 100644
index 0000000000000000000000000000000000000000..02764182e5850fbc2648d8d03fcc19f003c83456
GIT binary patch
literal 1907
zc%17D@N?(olHy`uVBq!ia0y~yU}OMc4kjRVS-{>9#48SRcVbv~PUa<$!;<dk>&U>c
zv7h@-A}f&3S>O>_%)r2R7=#&*=dVZs3QCo@MwA5Sr<If^7Ns%-BxdH7==r&ZD3lrN
znd%uD7<?&O$iTq%$kW9!q$2L^^@F+2jsk}-yxspYzub}WbJLxr3y+q5+V}lW8_Nav
z2PTb|kGJ#pzYt_%aR77rZJe@NSU4IEWHK%9=a-kes0`!CSGHW?;1pnJyv*V!FK=hF
z$ejbqvH!%eQcy^NfoVDC96P(33YUHXD5vg;V34wk0|Senutjanj}IMkicrp<6Us~6
zJQ^4{=BO3?`tjkRpsf>(Gtu3ncLD>WfQ9daFCQNsR<3G+ag_TfNGUQhDHO~)@bdBD
zcK0tFFpj&NqNx+i52GF$^$_hnBrdn`xv&RkO<fREKZ9=Lm&@Y+{_}a=w|{ANLrB5l
zPkF}gkKXDGjDFD$3`_zC_A|;hUVbfYanHOVzoAjGOq9c+A+MJCB#Xj<13bIASQH$#
z?`uq95=cmBi)CdJSP*^R!HAK=z~JyYCPt16Yx5OmGO$R@NDOaeV0m%Pe1Z=H6VI6q
ztAR$Byq5M*V_;-UyAi6uz_{xxuZnO31GDiPErAAxyT8~baXO4zH)`GRv+g0g<Ckg4
UqEUsvfpsE-r>mdKI;Vst03`dC+W-In
new file mode 100644
index 0000000000000000000000000000000000000000..348330a558b1afd0ca9bf30407a89240df1db161
GIT binary patch
literal 1358
zc%17D@N?(olHy`uVBq!ia0y~yU}OMc4kjRVS-{>9#48SRcVbv~PUa<$!;<dk>&U>c
zv7h@-A}f&3S>O>_%)r2R7=#&*=dVZs3QCo@MwA5Sr<If^7Ns%-BxdH7==r&ZD3lrN
znd%uD7<?&O2sCN0r;B4qMcmsfjhqYy0!)VA<9GeF)qB9iR#Gj@6x*0rd|JJLiOoSl
zcY@w~CQb>4#w`xJ_WV~)U|_k#^zzfc{su+?5AG$Wf7`<p{pT1}G^%J+(WoLCE7I5h
az~~jt_v!czqYuF1j=|H_&t;ucLK6TKxFTEt
new file mode 100644
index 0000000000000000000000000000000000000000..5eedbdfb1c5227d31b6039752f3d21ace0004b62
GIT binary patch
literal 1937
zc%17D@N?(olHy`uVBq!ia0y~yU}OMc4kjRVS-{>9NU@|l`Z_W&Z0zU$lgJ9>a~60+
z7BevL9RguSQ4OyKprBNVYeY$Kep*R+Vo@qXKw@TIiJqTph(ejMo~fRpfx(xeg$xYr
zyq+$OAr*0NuWjUIHWWDGP`d8Ym0R`V!aBUqS-yFket!41xZZ_dWsS`F^1tE_%(Jgz
zOkg*t`{%xbVMC)tJi}-11ZKm!e}DEe+;Hg8Z}`ay6t%Da7srsJa7_HbA10vaeEWKR
z1~Y-j+zEAzK+*H__lq+~cYI_u*bfqYe*Qjp1MiU^Of%v^qMx6?XFb4{RKs{iA0+zo
z^LHko1^XDDi33Id{P|hUIBM;vwWHP&w)T#mgLp;l3#R1^Z<xOPIvCIRz@E`ELtLYQ
zX#-nQ6{844*o8;j3mDck&WK}RZ4lk^gGqxSTVa{F17iZK?mh;t15zC?Spyg%9J}>L
gwTx;R5nAehTT6dAk@*K$=`t{Qy85}Sb4q9e08qc=VgLXD
new file mode 100644
index 0000000000000000000000000000000000000000..838b9566119961ac8cb51095733428734d1e93fb
GIT binary patch
literal 1894
zc%17D@N?(olHy`uVBq!ia0y~yU}OMc4kjRVS-{>9NU@|l`Z_W&Z0zU$lgJ9>a~60+
z7BevL9RguSQ4OyKprBNVYeY$Kep*R+Vo@qXKw@TIiJqTph(ejMo~fRpfx(xeg$xXA
zk33x*Ln`9lUO$-Y>?m;f!rMRF^U56=KR4Z3y6|Y}r+wf5w6R=pe_+yh`FJ~j{|iAT
z76&k=-^MAcg@vQxKqk}jetvnmi^?#Ld}YfO4o(4v#>*^z^73{zi`+S&9Q#ikD+PrV
z7?_rG&atzrsc`8RfO6`d2nH#uI54pI30u_G{P@rzrwHZzIibA7&7*;VV~$$EuOA;C
z3felsI1}AHdM7Y23Rw6)`10}LVdbh87)QB(f|Md7lS09)11}#RZg>B}0pqyKDVjRL
z{4naFQ4i7HL*jA^p9_0%*3<<t^)u);ez`3E??0c{efyVYH-r=%{*-6@{^+gFz~~q4
zz`!JMU_Ya5<K@@V7Wd2>@*5f@%S1UG8uDtHPqHW+IKZ=;i$%d<`@Y5$CV_;6wpdms
zfd$d`9gG+`3=9shV`AjEur^;|CIgGajKuIp29_7s%qRFTF!7w(uo`G|$!lp3H3mku
zv>Txc42-+J@~Q|oFfbdx(GqB2xciH35~stcb)(h|KkFW{_g(K+_FU%Q4y+RyJYD@<
J);T3K0RWLuk*5Fv
new file mode 100644
--- /dev/null
+++ b/content/canvas/test/reftest/reftest.list
@@ -0,0 +1,187 @@
+# WebGL Reftests!
+# If you add new tests, don't forget to add sanity (&nogl) tests! (if needed)
+
+# Check that disabling works:
+                           == webgl-disable-test.html?nogl  wrapper.html?green.png
+pref(webgl.disabled,true)  == webgl-disable-test.html       wrapper.html?green.png
+
+# Basic WebGL tests:
+# Do we get pixels to the screen at all?
+# Try to just hit the different rendering paths here.
+# Test: {aa, alpha, preserve, readback} = 16
+== webgl-clear-test.html?nogl  wrapper.html?green.png
+
+== webgl-clear-test.html?__&_____&________  wrapper.html?green.png
+== webgl-clear-test.html?aa&_____&________  wrapper.html?green.png
+== webgl-clear-test.html?__&alpha&________  wrapper.html?green.png
+== webgl-clear-test.html?aa&alpha&________  wrapper.html?green.png
+== webgl-clear-test.html?__&_____&preserve  wrapper.html?green.png
+== webgl-clear-test.html?aa&_____&preserve  wrapper.html?green.png
+== webgl-clear-test.html?__&alpha&preserve  wrapper.html?green.png
+== webgl-clear-test.html?aa&alpha&preserve  wrapper.html?green.png
+
+pref(webgl.force-layers-readback,true)  == webgl-clear-test.html?readback&__&_____&________  wrapper.html?green.png
+pref(webgl.force-layers-readback,true)  == webgl-clear-test.html?readback&aa&_____&________  wrapper.html?green.png
+pref(webgl.force-layers-readback,true)  == webgl-clear-test.html?readback&__&alpha&________  wrapper.html?green.png
+pref(webgl.force-layers-readback,true)  == webgl-clear-test.html?readback&aa&alpha&________  wrapper.html?green.png
+pref(webgl.force-layers-readback,true)  == webgl-clear-test.html?readback&__&_____&preserve  wrapper.html?green.png
+pref(webgl.force-layers-readback,true)  == webgl-clear-test.html?readback&aa&_____&preserve  wrapper.html?green.png
+pref(webgl.force-layers-readback,true)  == webgl-clear-test.html?readback&__&alpha&preserve  wrapper.html?green.png
+pref(webgl.force-layers-readback,true)  == webgl-clear-test.html?readback&aa&alpha&preserve  wrapper.html?green.png
+
+# Check orientation:
+== webgl-orientation-test.html?nogl  wrapper.html?white-top-left.png
+
+== webgl-orientation-test.html?__&_____&________  wrapper.html?white-top-left.png
+== webgl-orientation-test.html?aa&_____&________  wrapper.html?white-top-left.png
+== webgl-orientation-test.html?__&alpha&________  wrapper.html?white-top-left.png
+== webgl-orientation-test.html?aa&alpha&________  wrapper.html?white-top-left.png
+== webgl-orientation-test.html?__&_____&preserve  wrapper.html?white-top-left.png
+== webgl-orientation-test.html?aa&_____&preserve  wrapper.html?white-top-left.png
+== webgl-orientation-test.html?__&alpha&preserve  wrapper.html?white-top-left.png
+== webgl-orientation-test.html?aa&alpha&preserve  wrapper.html?white-top-left.png
+
+pref(webgl.force-layers-readback,true)  == webgl-orientation-test.html?readback&__&_____&________  wrapper.html?white-top-left.png
+pref(webgl.force-layers-readback,true)  == webgl-orientation-test.html?readback&aa&_____&________  wrapper.html?white-top-left.png
+pref(webgl.force-layers-readback,true)  == webgl-orientation-test.html?readback&__&alpha&________  wrapper.html?white-top-left.png
+pref(webgl.force-layers-readback,true)  == webgl-orientation-test.html?readback&aa&alpha&________  wrapper.html?white-top-left.png
+pref(webgl.force-layers-readback,true)  == webgl-orientation-test.html?readback&__&_____&preserve  wrapper.html?white-top-left.png
+pref(webgl.force-layers-readback,true)  == webgl-orientation-test.html?readback&aa&_____&preserve  wrapper.html?white-top-left.png
+pref(webgl.force-layers-readback,true)  == webgl-orientation-test.html?readback&__&alpha&preserve  wrapper.html?white-top-left.png
+pref(webgl.force-layers-readback,true)  == webgl-orientation-test.html?readback&aa&alpha&preserve  wrapper.html?white-top-left.png
+
+# Does we draw the correct color in the correct places with all context creation options?
+# (Note that our context creation option matrix is 2^6 = 64)
+== webgl-color-test.html?nogl  wrapper.html?colors.png
+
+== webgl-color-test.html?__&_____&_____&_______&________&_______  wrapper.html?colors.png
+== webgl-color-test.html?aa&_____&_____&_______&________&_______  wrapper.html?colors.png
+== webgl-color-test.html?__&alpha&_____&_______&________&_______  wrapper.html?colors.png
+== webgl-color-test.html?aa&alpha&_____&_______&________&_______  wrapper.html?colors.png
+== webgl-color-test.html?__&_____&depth&_______&________&_______  wrapper.html?colors.png
+== webgl-color-test.html?aa&_____&depth&_______&________&_______  wrapper.html?colors.png
+== webgl-color-test.html?__&alpha&depth&_______&________&_______  wrapper.html?colors.png
+== webgl-color-test.html?aa&alpha&depth&_______&________&_______  wrapper.html?colors.png
+== webgl-color-test.html?__&_____&_____&premult&________&_______  wrapper.html?colors.png
+== webgl-color-test.html?aa&_____&_____&premult&________&_______  wrapper.html?colors.png
+== webgl-color-test.html?__&alpha&_____&premult&________&_______  wrapper.html?colors.png
+== webgl-color-test.html?aa&alpha&_____&premult&________&_______  wrapper.html?colors.png
+== webgl-color-test.html?__&_____&depth&premult&________&_______  wrapper.html?colors.png
+== webgl-color-test.html?aa&_____&depth&premult&________&_______  wrapper.html?colors.png
+== webgl-color-test.html?__&alpha&depth&premult&________&_______  wrapper.html?colors.png
+== webgl-color-test.html?aa&alpha&depth&premult&________&_______  wrapper.html?colors.png
+
+== webgl-color-test.html?__&_____&_____&_______&preserve&_______  wrapper.html?colors.png
+== webgl-color-test.html?aa&_____&_____&_______&preserve&_______  wrapper.html?colors.png
+== webgl-color-test.html?__&alpha&_____&_______&preserve&_______  wrapper.html?colors.png
+== webgl-color-test.html?aa&alpha&_____&_______&preserve&_______  wrapper.html?colors.png
+== webgl-color-test.html?__&_____&depth&_______&preserve&_______  wrapper.html?colors.png
+== webgl-color-test.html?aa&_____&depth&_______&preserve&_______  wrapper.html?colors.png
+== webgl-color-test.html?__&alpha&depth&_______&preserve&_______  wrapper.html?colors.png
+== webgl-color-test.html?aa&alpha&depth&_______&preserve&_______  wrapper.html?colors.png
+== webgl-color-test.html?__&_____&_____&premult&preserve&_______  wrapper.html?colors.png
+== webgl-color-test.html?aa&_____&_____&premult&preserve&_______  wrapper.html?colors.png
+== webgl-color-test.html?__&alpha&_____&premult&preserve&_______  wrapper.html?colors.png
+== webgl-color-test.html?aa&alpha&_____&premult&preserve&_______  wrapper.html?colors.png
+== webgl-color-test.html?__&_____&depth&premult&preserve&_______  wrapper.html?colors.png
+== webgl-color-test.html?aa&_____&depth&premult&preserve&_______  wrapper.html?colors.png
+== webgl-color-test.html?__&alpha&depth&premult&preserve&_______  wrapper.html?colors.png
+== webgl-color-test.html?aa&alpha&depth&premult&preserve&_______  wrapper.html?colors.png
+
+== webgl-color-test.html?__&_____&_____&_______&________&stencil  wrapper.html?colors.png
+== webgl-color-test.html?aa&_____&_____&_______&________&stencil  wrapper.html?colors.png
+== webgl-color-test.html?__&alpha&_____&_______&________&stencil  wrapper.html?colors.png
+== webgl-color-test.html?aa&alpha&_____&_______&________&stencil  wrapper.html?colors.png
+== webgl-color-test.html?__&_____&depth&_______&________&stencil  wrapper.html?colors.png
+== webgl-color-test.html?aa&_____&depth&_______&________&stencil  wrapper.html?colors.png
+== webgl-color-test.html?__&alpha&depth&_______&________&stencil  wrapper.html?colors.png
+== webgl-color-test.html?aa&alpha&depth&_______&________&stencil  wrapper.html?colors.png
+== webgl-color-test.html?__&_____&_____&premult&________&stencil  wrapper.html?colors.png
+== webgl-color-test.html?aa&_____&_____&premult&________&stencil  wrapper.html?colors.png
+== webgl-color-test.html?__&alpha&_____&premult&________&stencil  wrapper.html?colors.png
+== webgl-color-test.html?aa&alpha&_____&premult&________&stencil  wrapper.html?colors.png
+== webgl-color-test.html?__&_____&depth&premult&________&stencil  wrapper.html?colors.png
+== webgl-color-test.html?aa&_____&depth&premult&________&stencil  wrapper.html?colors.png
+== webgl-color-test.html?__&alpha&depth&premult&________&stencil  wrapper.html?colors.png
+== webgl-color-test.html?aa&alpha&depth&premult&________&stencil  wrapper.html?colors.png
+
+== webgl-color-test.html?__&_____&_____&_______&preserve&stencil  wrapper.html?colors.png
+== webgl-color-test.html?aa&_____&_____&_______&preserve&stencil  wrapper.html?colors.png
+== webgl-color-test.html?__&alpha&_____&_______&preserve&stencil  wrapper.html?colors.png
+== webgl-color-test.html?aa&alpha&_____&_______&preserve&stencil  wrapper.html?colors.png
+== webgl-color-test.html?__&_____&depth&_______&preserve&stencil  wrapper.html?colors.png
+== webgl-color-test.html?aa&_____&depth&_______&preserve&stencil  wrapper.html?colors.png
+== webgl-color-test.html?__&alpha&depth&_______&preserve&stencil  wrapper.html?colors.png
+== webgl-color-test.html?aa&alpha&depth&_______&preserve&stencil  wrapper.html?colors.png
+== webgl-color-test.html?__&_____&_____&premult&preserve&stencil  wrapper.html?colors.png
+== webgl-color-test.html?aa&_____&_____&premult&preserve&stencil  wrapper.html?colors.png
+== webgl-color-test.html?__&alpha&_____&premult&preserve&stencil  wrapper.html?colors.png
+== webgl-color-test.html?aa&alpha&_____&premult&preserve&stencil  wrapper.html?colors.png
+== webgl-color-test.html?__&_____&depth&premult&preserve&stencil  wrapper.html?colors.png
+== webgl-color-test.html?aa&_____&depth&premult&preserve&stencil  wrapper.html?colors.png
+== webgl-color-test.html?__&alpha&depth&premult&preserve&stencil  wrapper.html?colors.png
+== webgl-color-test.html?aa&alpha&depth&premult&preserve&stencil  wrapper.html?colors.png
+
+
+# Check a smaller selection for readback:
+pref(webgl.force-layers-readback,true)  == webgl-color-test.html?readback&__&_____&________  wrapper.html?colors.png
+pref(webgl.force-layers-readback,true)  == webgl-color-test.html?readback&aa&_____&________  wrapper.html?colors.png
+pref(webgl.force-layers-readback,true)  == webgl-color-test.html?readback&__&alpha&________  wrapper.html?colors.png
+pref(webgl.force-layers-readback,true)  == webgl-color-test.html?readback&aa&alpha&________  wrapper.html?colors.png
+pref(webgl.force-layers-readback,true)  == webgl-color-test.html?readback&__&_____&preserve  wrapper.html?colors.png
+pref(webgl.force-layers-readback,true)  == webgl-color-test.html?readback&aa&_____&preserve  wrapper.html?colors.png
+pref(webgl.force-layers-readback,true)  == webgl-color-test.html?readback&__&alpha&preserve  wrapper.html?colors.png
+pref(webgl.force-layers-readback,true)  == webgl-color-test.html?readback&aa&alpha&preserve  wrapper.html?colors.png
+
+
+# Check alpha behavior:
+== webgl-color-alpha-test.html?colorVal=1.0&alphaVal=1.0&nogl        wrapper.html?colors.png
+== webgl-color-alpha-test.html?colorVal=1.0&alphaVal=1.0             wrapper.html?colors.png
+fuzzy(1,65536) == webgl-color-alpha-test.html?colorVal=0.5&alphaVal=1.0&nogl        wrapper.html?half-colors.png
+fuzzy(1,65536) == webgl-color-alpha-test.html?colorVal=0.5&alphaVal=1.0             wrapper.html?half-colors.png
+== webgl-color-alpha-test.html?colorVal=0.0&alphaVal=1.0&nogl        wrapper.html?black.png
+== webgl-color-alpha-test.html?colorVal=0.0&alphaVal=1.0             wrapper.html?black.png
+
+== webgl-color-alpha-test.html?colorVal=1.0&alphaVal=0.0&nogl        wrapper.html?colors.png
+== webgl-color-alpha-test.html?colorVal=1.0&alphaVal=0.0             wrapper.html?colors.png
+== webgl-color-alpha-test.html?colorVal=1.0&alphaVal=0.0&alpha&nogl  wrapper.html?white.png
+== webgl-color-alpha-test.html?colorVal=1.0&alphaVal=0.0&alpha       wrapper.html?white.png
+
+# Test premult:
+fuzzy(1,65536) == webgl-color-alpha-test.html?colorVal=1.0&alphaVal=0.5&alpha&nogl          wrapper.html?colors-half-alpha.png
+fuzzy(1,65536) == webgl-color-alpha-test.html?colorVal=1.0&alphaVal=0.5&alpha               wrapper.html?colors-half-alpha.png
+fuzzy(1,65536) == webgl-color-alpha-test.html?colorVal=0.5&alphaVal=0.5&alpha&nogl          wrapper.html?half-colors-half-alpha.png
+fuzzy(1,65536) == webgl-color-alpha-test.html?colorVal=0.5&alphaVal=0.5&alpha               wrapper.html?half-colors-half-alpha.png
+fuzzy(1,65536) == webgl-color-alpha-test.html?colorVal=0.5&alphaVal=0.5&alpha&premult&nogl  wrapper.html?colors-half-alpha.png
+fuzzy(1,65536) == webgl-color-alpha-test.html?colorVal=0.5&alphaVal=0.5&alpha&premult       wrapper.html?colors-half-alpha.png
+
+# Test over-bright premult:
+fuzzy(1,65536) == webgl-color-alpha-test.html?colorVal=1.0&alphaVal=0.5&alpha&premult&nogl  wrapper.html?colors-half-alpha.png
+fuzzy(1,65536) == webgl-color-alpha-test.html?colorVal=1.0&alphaVal=0.5&alpha&premult       wrapper.html?colors-half-alpha.png
+
+
+# Check for hanging framebuffer bindings:
+== webgl-hanging-fb-test.html?nogl  wrapper.html?green.png
+
+== webgl-hanging-fb-test.html       wrapper.html?green.png
+== webgl-hanging-fb-test.html?aa    wrapper.html?green.png
+pref(webgl.force-layers-readback,true)  == webgl-hanging-fb-test.html?readback     wrapper.html?green.png
+pref(webgl.force-layers-readback,true)  == webgl-hanging-fb-test.html?readback&aa  wrapper.html?green.png
+
+== webgl-hanging-scissor-test.html       wrapper.html?green.png
+== webgl-hanging-scissor-test.html?aa    wrapper.html?green.png
+pref(webgl.force-layers-readback,true)  == webgl-hanging-scissor-test.html?readback     wrapper.html?green.png
+pref(webgl.force-layers-readback,true)  == webgl-hanging-scissor-test.html?readback&aa  wrapper.html?green.png
+
+
+# Check that our experimental prefs still work:
+
+# 16bpp:
+pref(webgl.prefer-16bpp,true)                                        == webgl-color-test.html?16bpp           wrapper.html?colors.png
+pref(webgl.prefer-16bpp,true) pref(webgl.force-layers-readback,true) == webgl-color-test.html?16bpp&readback  wrapper.html?colors.png
+
+# Force native GL (Windows):
+skip-if(!winWidget) pref(webgl.prefer-native-gl,true)                                == webgl-clear-test.html?native-gl        wrapper.html?green.png
+skip-if(!winWidget) pref(webgl.prefer-native-gl,true)                                == webgl-orientation-test.html?native-gl  wrapper.html?white-top-left.png
+skip-if(!winWidget) pref(webgl.prefer-native-gl,true)                                == webgl-color-test.html?native-gl        wrapper.html?colors.png
+skip-if(!winWidget) pref(webgl.prefer-native-gl,true) pref(webgl.prefer-16bpp,true)  == webgl-color-test.html?native-gl&16bpp  wrapper.html?colors.png
new file mode 100644
--- /dev/null
+++ b/content/canvas/test/reftest/webgl-clear-test.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+
+<script type="text/javascript" src="webgl-utils.js"></script>
+<script type="text/javascript">
+/* Clear Test
+ *
+ * Clear the canvas to green to test that we get pixels to the screen.
+ */
+
+"use strict";
+
+function renderGL(gl) {
+  gl.clearColor(0.0, 1.0, 0.0, 1.0);
+  gl.clear(gl.COLOR_BUFFER_BIT);
+  gl.finish();
+}
+
+function renderBackup(canvas) {
+  var context = canvas.getContext("2d");
+  context.fillStyle = "rgba(0, 255, 0, 1.0)";
+  context.fillRect(0, 0, 256, 256);
+}
+
+function onLoad() {
+  var canvas = document.getElementById("canvas");
+  var gl = initGL(canvas);
+
+  if (gl)
+    renderGL(gl);
+  else
+    renderBackup(canvas);
+}
+</script>
+</head>
+
+<body onload="onLoad();">
+  <canvas id="canvas" width="256" height="256"></canvas>
+</body>
+
+</html>
new file mode 100644
--- /dev/null
+++ b/content/canvas/test/reftest/webgl-color-alpha-test.html
@@ -0,0 +1,96 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+
+<script type="text/javascript" src="webgl-utils.js"></script>
+<script type="text/javascript">
+/* Color-Alpha Test
+ *
+ * Clear the four quadrants of the canvas as follows:
+ * +------+------+
+ * | red  |green |
+ * |      |      |
+ * +------+------+
+ * | blue |white |
+ * |      |      |
+ * +------+------+
+ * However, unlike the Color test, clear with a given alpha value.
+ * What effect this has depends on the context-creation args passed
+ * to this page.
+ *
+ * Here we check that we handle various combinations of alpha and
+ * premultipliedAlpha correctly.
+ */
+
+"use strict";
+
+function renderGL(gl, value, alpha) {
+  gl.enable(gl.SCISSOR_TEST);
+
+  gl.scissor(0, 128, 128, 128);
+  gl.clearColor(value, 0.0, 0.0, alpha);
+  gl.clear(gl.COLOR_BUFFER_BIT);
+
+  gl.scissor(128, 128, 128, 128);
+  gl.clearColor(0.0, value, 0.0, alpha);
+  gl.clear(gl.COLOR_BUFFER_BIT);
+
+  gl.scissor(0, 0, 128, 128);
+  gl.clearColor(0.0, 0.0, value, alpha);
+  gl.clear(gl.COLOR_BUFFER_BIT);
+
+  gl.scissor(128, 0, 128, 128);
+  gl.clearColor(value, value, value, alpha);
+  gl.clear(gl.COLOR_BUFFER_BIT);
+
+  gl.finish();
+}
+
+function renderBackup(canvas, value, alpha) {
+  if (!arg("alpha"))
+    alpha = 1.0;
+
+  if (arg("alpha") && arg("premult")) {
+    if (alpha == 0.0)
+      value = 1.0;
+    else
+      value /= alpha;
+  }
+
+  var intValue = (value * 255) | 0;
+  var context = canvas.getContext("2d");
+  context.fillStyle = "rgba(" + intValue + ", 0, 0, " + alpha + ")";
+  context.fillRect(0, 0, 128, 128);
+
+  context.fillStyle = "rgba(0, " + intValue + ", 0, " + alpha + ")";
+  context.fillRect(128, 0, 128, 128);
+
+  context.fillStyle = "rgba(0, 0, " + intValue + ", " + alpha + ")";
+  context.fillRect(0, 128, 128, 128);
+
+  context.fillStyle = "rgba(" + intValue + ", " + intValue + ", " + intValue + ", " + alpha + ")";
+  context.fillRect(128, 128, 128, 128);
+}
+
+function onLoad() {
+  var canvas = document.getElementById("canvas");
+  var gl = initGL(canvas);
+
+  var value = arg("colorVal");
+  var alpha = arg("alphaVal");
+
+  if (gl)
+    renderGL(gl, value, alpha);
+  else
+    renderBackup(canvas, value, alpha);
+}
+
+</script>
+</head>
+
+<body onload="onLoad();">
+  <canvas id="canvas" width="256" height="256"></canvas>
+</body>
+
+</html>
new file mode 100644
--- /dev/null
+++ b/content/canvas/test/reftest/webgl-color-test.html
@@ -0,0 +1,80 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+
+<script type="text/javascript" src="webgl-utils.js"></script>
+<script type="text/javascript">
+/* Color Test
+ *
+ * Clear the four quadrants of the canvas as follows:
+ * +------+------+
+ * | red  |green |
+ * |      |      |
+ * +------+------+
+ * | blue |white |
+ * |      |      |
+ * +------+------+
+ *
+ * This is for checking that we're getting the right colors when
+ * we ask for them. This combined with the Orientation test assure
+ * that we are getting the correct colors in the correct places.
+ */
+
+"use strict";
+
+function renderGL(gl) {
+  gl.enable(gl.SCISSOR_TEST);
+
+  gl.scissor(0, 128, 128, 128);
+  gl.clearColor(1.0, 0.0, 0.0, 1.0);
+  gl.clear(gl.COLOR_BUFFER_BIT);
+
+  gl.scissor(128, 128, 128, 128);
+  gl.clearColor(0.0, 1.0, 0.0, 1.0);
+  gl.clear(gl.COLOR_BUFFER_BIT);
+
+  gl.scissor(0, 0, 128, 128);
+  gl.clearColor(0.0, 0.0, 1.0, 1.0);
+  gl.clear(gl.COLOR_BUFFER_BIT);
+
+  gl.scissor(128, 0, 128, 128);
+  gl.clearColor(1.0, 1.0, 1.0, 1.0);
+  gl.clear(gl.COLOR_BUFFER_BIT);
+
+  gl.finish();
+}
+
+function renderBackup(canvas) {
+  var context = canvas.getContext("2d");
+  context.fillStyle = "rgba(255, 0, 0, 1.0)";
+  context.fillRect(0, 0, 128, 128);
+
+  context.fillStyle = "rgba(0, 255, 0, 1.0)";
+  context.fillRect(128, 0, 128, 128);
+
+  context.fillStyle = "rgba(0, 0, 255, 1.0)";
+  context.fillRect(0, 128, 128, 128);
+
+  context.fillStyle = "rgba(255, 255, 255, 1.0)";
+  context.fillRect(128, 128, 128, 128);
+}
+
+function onLoad() {
+  var canvas = document.getElementById("canvas");
+  var gl = initGL(canvas);
+
+  if (gl)
+    renderGL(gl);
+  else
+    renderBackup(canvas);
+}
+
+</script>
+</head>
+
+<body onload="onLoad();">
+  <canvas id="canvas" width="256" height="256"></canvas>
+</body>
+
+</html>
new file mode 100644
--- /dev/null
+++ b/content/canvas/test/reftest/webgl-disable-test.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+
+<script type="text/javascript" src="webgl-utils.js"></script>
+<script type="text/javascript">
+/* Disable Test
+ *
+ * If we succeed in getting a WebGL context, we will fill
+ * the canvas with red. If we fail to acquire a WebGL context,
+ * we will use Canvas2D to instead fill it with green.
+ *
+ * Note that this test differs from the others in that
+ * it will draw differently if it receives a WebGL context.
+ * Other tests are designed to fallback silently to Canvas2D.
+ *
+ * We use this test to assure that when we disable WebGL,
+ * WebGL does not function. This is trivially true for systems
+ * that don't support WebGL. This test is not viable for testing
+ * that WebGL works, as blocklisted systems will always draw green.
+ */
+
+"use strict";
+
+function renderGL(gl) {
+  gl.clearColor(1.0, 0.0, 0.0, 1.0);
+  gl.clear(gl.COLOR_BUFFER_BIT);
+  gl.finish();
+}
+
+function renderBackup(canvas) {
+  var context = canvas.getContext("2d");
+  context.fillStyle = "rgba(0, 255, 0, 1.0)";
+  context.fillRect(0, 0, 256, 256);
+}
+
+function onLoad() {
+  var canvas = document.getElementById("canvas");
+  var gl = initGL(canvas);
+
+  if (gl)
+    renderGL(gl);
+  else
+    renderBackup(canvas);
+}
+
+</script>
+</head>
+
+<body onload="onLoad();">
+  <canvas id="canvas" width="256" height="256"></canvas>
+</body>
+
+</html>
new file mode 100644
--- /dev/null
+++ b/content/canvas/test/reftest/webgl-hanging-fb-test.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+
+<script type="text/javascript" src="webgl-utils.js"></script>
+<script type="text/javascript">
+/* Hanging Framebuffer Test
+ *
+ * Clear the canvas to green, but create and bind a new framebuffer
+ * before returning. This will fail if we blindly read from the bound
+ * framebuffer, instead of binding to the screen and reading from that.
+ *
+ * How failure looks isn't well defined, since this is an empty framebuffer,
+ * thus is incomplete, and should cause errors if it's read from.
+ */
+
+"use strict";
+
+function renderGL(gl) {
+  gl.clearColor(0.0, 1.0, 0.0, 1.0);
+  gl.clear(gl.COLOR_BUFFER_BIT);
+
+  var fb = gl.createFramebuffer();
+  gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
+
+  gl.finish();
+}
+
+function renderBackup(canvas) {
+  var context = canvas.getContext("2d");
+  context.fillStyle = "rgba(0, 255, 0, 1.0)";
+  context.fillRect(0, 0, 256, 256);
+}
+
+function onLoad() {
+  var canvas = document.getElementById("canvas");
+  var gl = initGL(canvas);
+
+  if (gl)
+    renderGL(gl);
+  else
+    renderBackup(canvas);
+}
+
+</script>
+</head>
+
+<body onload="onLoad();">
+  <canvas id="canvas" width="256" height="256"></canvas>
+</body>
+
+</html>
new file mode 100644
--- /dev/null
+++ b/content/canvas/test/reftest/webgl-hanging-scissor-test.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+
+<script type="text/javascript" src="webgl-utils.js"></script>
+<script type="text/javascript">
+/* Hanging Scissor Test
+ *
+ * Clear the canvas to green, but create and enable and set scissor values
+ * before returning. This can fail if we blindly blit or read from the screen
+ * without disabling scissor-test.
+ *
+ * Failure should look like only the top-left quadrant is rendered.
+ */
+
+"use strict";
+
+function renderGL(gl) {
+  gl.clearColor(0.0, 1.0, 0.0, 1.0);
+  gl.clear(gl.COLOR_BUFFER_BIT);
+
+  gl.enable(gl.SCISSOR_TEST);
+  gl.scissor(0, 128, 128, 128);
+
+  gl.finish();
+}
+
+function renderBackup(canvas) {
+  var context = canvas.getContext("2d");
+  context.fillStyle = "rgba(0, 255, 0, 1.0)";
+  context.fillRect(0, 0, 256, 256);
+}
+
+function onLoad() {
+  var canvas = document.getElementById("canvas");
+  var gl = initGL(canvas);
+
+  if (gl)
+    renderGL(gl);
+  else
+    renderBackup(canvas);
+}
+
+</script>
+</head>
+
+<body onload="onLoad();">
+  <canvas id="canvas" width="256" height="256"></canvas>
+</body>
+
+</html>
new file mode 100644
--- /dev/null
+++ b/content/canvas/test/reftest/webgl-orientation-test.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+
+<script type="text/javascript" src="webgl-utils.js"></script>
+<script type="text/javascript">
+/* Orientation Test
+ *
+ * Clear the canvas to black, and clear the upper-left quadrant
+ * to white. If this doesn't pass, but the Clear test does, then
+ * likely y-flip is wrong.
+ */
+
+"use strict";
+
+function renderGL(gl) {
+  gl.clearColor(0.0, 0.0, 0.0, 1.0);
+  gl.clear(gl.COLOR_BUFFER_BIT);
+
+  gl.enable(gl.SCISSOR_TEST);
+  gl.scissor(0, 128, 128, 128);
+  gl.clearColor(1.0, 1.0, 1.0, 1.0);
+  gl.clear(gl.COLOR_BUFFER_BIT);
+
+  gl.finish();
+}
+
+function renderBackup(canvas) {
+  var context = canvas.getContext("2d");
+  context.fillStyle = "rgba(0, 0, 0, 1.0)";
+  context.fillRect(0, 0, 256, 256);
+
+  context.fillStyle = "rgba(255, 255, 255, 1.0)";
+  context.fillRect(0, 0, 128, 128);
+}
+
+function onLoad() {
+  var canvas = document.getElementById("canvas");
+  var gl = initGL(canvas);
+
+  if (gl)
+    renderGL(gl);
+  else
+    renderBackup(canvas);
+}
+
+</script>
+</head>
+
+<body onload="onLoad();">
+  <canvas id="canvas" width="256" height="256"></canvas>
+</body>
+
+</html>
new file mode 100644
--- /dev/null
+++ b/content/canvas/test/reftest/webgl-utils.js
@@ -0,0 +1,63 @@
+"use strict";
+
+function parseArgs() {
+  var query = window.location.search.substring(1);
+
+  var split = query.split("&");
+
+  var args = {}
+  for (var i = 0; i < split.length; i++) {
+    var pair = split[i].split("=");
+
+    var key = pair[0];
+    var value = true;
+    if (pair.length >= 2) {
+      eval("value = " + decodeURIComponent(pair[1]) + ";");
+    }
+
+    args[key] = value;
+  }
+
+  return args;
+}
+
+var gArgs = null;
+function arg(key) {
+  if (gArgs === null) {
+    gArgs = parseArgs();
+  }
+
+  var ret = gArgs[key];
+  if (ret === undefined)
+    ret = false;
+
+  return ret;
+}
+
+function initGL(canvas) {
+  if (arg("nogl"))
+    return null;
+
+  var gl = null;
+
+  var withAA = arg("aa");
+  var withAlpha = arg("alpha");
+  var withDepth = arg("depth");
+  var withPremult = arg("premult");
+  var withPreserve = arg("preserve");
+  var withStencil = arg("stencil");
+
+  try {
+    var argDict = {
+      alpha: withAlpha,
+      depth: withDepth,
+      stencil: withStencil,
+      antialias: withAA,
+      premultipliedAlpha: withPremult,
+      preserveDrawingBuffer: withPreserve,
+    };
+    gl = canvas.getContext("experimental-webgl", argDict);
+  } catch(e) {}
+
+  return gl;
+}
new file mode 100644
index 0000000000000000000000000000000000000000..224b193a5ec4d4f76d7dfc5bb8fa843336970a5f
GIT binary patch
literal 1418
zc%17D@N?(olHy`uVBq!ia0y~yU}OMc4kjRVS-{>9#48SRcVbv~PUa<$!;<dk>&U>c
zv7h@-A}f&3S>O>_%)r2R7=#&*=dVZs3QCo@MwA5Sr<If^7Ns%-BxdH7==r&ZD3lrN
znd%uD7<?&O2sG)Zr;B4qMcms<j)DvZ0!)T~X74+7!>)-jjmg@RRc)=qu6>`fuV1&5
z&tZ)*5X*ReUGDt)d#urn{5`C<er`Sfd3E{0umjA=jb(LjKmK_YyFv8Bfrtfj<Ew4<
zSBdAa+Kg%$)iP4Fa0)0mG%zqSv2cts20P<`I1~TxR&S%?Es`w2qLRVW)z4*}Q$iB}
Dj==(M
new file mode 100644
index 0000000000000000000000000000000000000000..23b21c59cb9c5138b84ade1c728d8fd61889956b
GIT binary patch
literal 1401
zc%17D@N?(olHy`uVBq!ia0y~yU}OMc4kjRVS-{>9#48SRcVbv~PUa<$!;<dk>&U>c
zv7h@-A}f&3S>O>_%)r2R7=#&*=dVZs3QCo@MwA5Sr<If^7Ns%-BxdH7==r&ZD3lrN
znd%uD7<?&O2sG)1r;B4qMcmuVj6gd%nhkzW-{&}k_d!uHPYZ9%3|T8?;RbaNX#t0-
zx(`erm@}D~JkImSG1MvKIxxKad64@6{}Nsf1zY<H#vhGa7#Wv5XV+)2pJ1lY@a4|~
z)(7mD*jOgali$Pe$Kh53!==y7;tlenhK(9FYS^e@^fl}c^PTNFR|<kpd;pe=44$rj
JF6*2UngFV23qb$?
new file mode 100644
--- /dev/null
+++ b/content/canvas/test/reftest/wrapper.html
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<head>
+<title>Image reftest wrapper</title>
+<style type="text/css">
+  #image1 { background-color: rgb(10, 100, 250); }
+</style>
+<script>
+  // The image is loaded async after the page loads
+  // wait for it to finish loading
+  function onImageLoad() { 
+    document.documentElement.removeAttribute("class");
+  };
+</script>
+</head>
+<body>
+<img id="image1">
+<script>
+  // Use as "wrapper.html?image.png"
+  var imgURL = document.location.search.substr(1);
+  document.images[0].onload = onImageLoad;
+  document.images[0].onerror = onImageLoad;
+  document.images[0].src = imgURL;
+</script>
+</body>
+</html>
+
--- a/content/test/reftest/reftest.list
+++ b/content/test/reftest/reftest.list
@@ -1,8 +1,13 @@
+# Canvas reftests
+# From: /content/test/reftest
+# To:   /content/canvas/test/reftest
+include ../../canvas/test/reftest/reftest.list
+
 == bug453105.html bug453105-ref.html
 == optiontext.html optiontext-ref.html
 == bug456008.xhtml bug456008-ref.html
 == bug439965.html bug439965-ref.html
 == bug427779.xml bug427779-ref.xml
 == bug559996.html bug559996-ref.html
 == bug591981-1.html bug591981-ref.html
 == bug591981-2.html bug591981-ref.html
--- a/image/test/reftest/bmp/bmp-corrupted/wrapper.html
+++ b/image/test/reftest/bmp/bmp-corrupted/wrapper.html
@@ -11,17 +11,17 @@
   function onImageLoad() { 
     document.documentElement.removeAttribute("class");
   };
 </script>
 </head>
 <body>
 <img id="image1">
 <script>
-  // Use as "wrapper.html?image.png
+  // Use as "wrapper.html?image.png"
   var imgURL = document.location.search.substr(1);
   document.images[0].onload = onImageLoad;
   document.images[0].onerror = onImageLoad;
   document.images[0].src = imgURL;
 </script>
 </body>
 </html>