added some tests
authoradam <adam@megacz.com>
Sat, 11 Mar 2006 10:26:41 +0000 (10:26 +0000)
committeradam <adam@megacz.com>
Sat, 11 Mar 2006 10:26:41 +0000 (10:26 +0000)
darcs-hash:20060311102641-5007d-cc694c7700258791aafacb220345575e0276617d.gz

tests/better.t [new file with mode: 0644]
tests/goat.t [new file with mode: 0644]
tests/main.t [new file with mode: 0644]
tests/mux.t [new file with mode: 0644]
tests/test2.t [new file with mode: 0644]
tests/test3.t [new file with mode: 0644]

diff --git a/tests/better.t b/tests/better.t
new file mode 100644 (file)
index 0000000..2ce0f5e
--- /dev/null
@@ -0,0 +1,17 @@
+<ibex>
+    <ui:box maxwidth="500" maxheight="300" cols="3">
+        ibex.ui.frame = thisbox;
+        <ui:box fill="black" colspan="2" minwidth="200" minheight="100"/>
+        <ui:box fill="green" rowspan="2" minwidth="100" id="foo"/>
+        <ui:box fill="red" minwidth="50" minheight="100" />
+        <ui:box fill="blue" cols="5">
+            <ui:box height="10" colspan="5"/>
+            <ui:box width="10"/>
+            <ui:box height="10" fill="white" maxwidth="100"/>
+            <ui:box height="10" fill="black" colspan="2" minwidth="100"/>
+            <ui:box width="10"/>
+        </ui:box>
+        <ui:box fill="purple" minwidth="70" minheight="50"/>
+        <ui:box fill="yellow" colspan="2"/>
+    </ui:box>
+</ibex>
diff --git a/tests/goat.t b/tests/goat.t
new file mode 100644 (file)
index 0000000..80f0c35
--- /dev/null
@@ -0,0 +1,108 @@
+<ibex xmlns:ui="ibex://ui">
+    <ui:box maxwidth="600" maxheight="600" fill="white" align="center">
+        ibex.ui.frame = thisbox;
+
+
+        // this thread makes things spin.
+        var rot = 0;
+        ibex.thread = function(f) { while(true) {
+             ibex.thread.yield();
+             $top.transform = "rotate(" + rot + ")";
+             rot += 1;
+             //ibex.log.warn("rotate " + rot);
+       } }
+
+<ui:box fill="blue" align="center">
+<ui:box fill="orange" align="center" shrink="true" id="oran">
+
+<ui:box cols="4" id="top" fill="#010101">
+        <ui:box rowspan="4" rows="3" hshrink="true">
+            <ui:box fill="#aaa" width="16" height="16" stroke="white">
+                <ui:box path="M0,0 L0,8 L8,8 z" fill="black" transform="rotate(135)" stroke="black"/>
+            </ui:box>
+            <ui:box fill="#444"/>
+            <ui:box fill="#aaa" width="16" height="16" stroke="white">
+                <ui:box path="M0,0 L0,8 L8,8 z" fill="black" transform="rotate(315)" stroke="black"/>
+            </ui:box>
+        </ui:box>
+        <ui:box fill="gray" colspan="2" minwidth="100" minheight="100" id="top">
+            <ui:box fill="black" strokecolor="white"
+                                   path="M54.779,81.835c0.847-40.317,56.096-73.716,90.263-80.415
+                                         C73.619-8.782-24.675,67.687,28.052,141.565c5.521,0.496,
+                                         27.86-3.54,35.385-7.49C58.134,124.452,50.103,105.064,54.779,81.835z
+                                         M182.513,43.781c-5.059-1.853-10.438-2.893-15.958-3.253c
+                                         30.715,25.152,45.28,84.093,15.454,115.339c-26.878,28.158
+                                         -70.323,42.289-106.696,53.2c38.424-9.63,77.214-18.643,
+                                         116.103-26.248c-1.333,0.242-13.949,2.594-13.866,0.404c0.12
+                                         -3.14,16.464-12.773,19.268-16.032c10.844-12.613,15.836
+                                         -17.482,20.586-33.194c5.553-18.364,7.831-45.911,1.675
+                                         -64.204C209.099,57.506,196.103,48.757,182.513,43.781z
+                                         M224.802,225.093c0.678,2.063,1.026,3.722,1.18,4.972C226.256
+                                         228.668,225.834,226.936,224.802,225.093z
+                                         M225.981,230.064c-0.005,0.028-0.008,0.057-0.016,0.085C
+                                         225.145,233.909,226.449,233.862,225.981,230.064z
+                                         M131.069,141.951C126.527,142.18,127.545,
+                                         145.066,131.069,141.951L131.069,141.951z
+                                         M232.061,200.168C233.102,199.979,233.319,
+                                         199.921,232.061,200.168L232.061,200.168z
+                                         M115.957,226.415C94.884,231.696,99.719,
+                                         231.287,115.957,226.415L115.957,226.415z
+                                         M75.313,209.067C54.24,214.349,59.074,
+                                         213.939,75.313,209.067L75.313,209.067z
+                                         M191.416,182.819C192.456,182.632,192.674,
+                                         182.573,191.416,182.819L191.416,182.819z
+                                         M182.679,172.652c-30.74-26.898-45.771-30.996-51.609-30.701c
+                                         -3.524,3.115-4.542,0.229,0,0c0.128-0.113,0.257-0.233,0.392
+                                         -0.361c8.591-8.261,8.921-16.852,10.243-23.791c1.322
+                                         -6.94-1.322-16.522-3.635-17.844c-2.314-1.322-3.967-2.313
+                                         -5.948-0.661c-1.982,1.652-1.321,13.218-6.939,15.531c
+                                         -5.617,2.312-12.887,15.861-23.13,19.166c-10.243,3.304-10.906,5.618
+                                         -10.574,1.322c0.331-4.295,1.652-5.618-3.636-10.906,5.618
+                                         -13.219c-5.287-7.598-3.964-4.957-6.277-4.625c-2.313,0.331
+                                         -5.288,21.147-4.957,24.122c0.332,2.975-46.922,0.992-49.896
+                                         -1.321c-2.974-2.313,7.6,17.183,2.313,19.826s2.644-0.991
+                                         -3.305,2.644c-5.948,3.634,5.948,8.261,3.965,12.888c
+                                         -1.983,4.625-13.548,27.095-14.539,27.095c-0.992,0-13.879,28.087
+                                         -14.54,31.062c-0.661,2.975,1.982,6.279,1.982,10.905c0,4.627
+                                         -0.33,8.921,0.992,11.565c1.321,2.643,4.295
+                                         ,0.66,4.295,0.66l0.331,0.661c0,0,20.157,0.991,2.974,1.321c
+                                         -17.183,0.332,16.192,4.297,22.801-1.982c6.608-6.277,3.634,3.305,18.174,0.331c14.539
+                                         -2.975-10.244,5.618,48.574
+                                         -37.009c58.819-42.628,2.645,10.572,18.835,61.131c16.19,50.557
+                                         -9.914,12.558,30.07-39.982c34.655-45.539,68.3159,50.557
+                                         -28.522,75.167-16.292C221.744,215.796,211.955,198.271,182.679,172.652zM69.668,175.627c
+                                         -2.313,2.312-7.931,7.6-14.54,4.956c
+                                         -6.608-2.645-5.618-1.652-0.991-6.939c4.626-5.287,
+                                         9.913-2.313,11.234-1.321C66.694,173.312,71.982,173.312,
+                                         69.668,175.627z
+                                         M254.879,72.529C234.197,22.545,175.4-5.017,128.489,
+                                         4.84C64.623,18.258,24.879,78.747,39.102,142.748c9.741,
+                                         5.756,27.901,8.985,39.01,7.227c6.266-0.992,1.361-6.12,
+                                         0.752-10.031c-1.874-12.023,1.284-25.218,4.006-36.861c5.815-24.87,
+                                         14.041-40.508,37.703-52.29c23.309-11.607,49.987-14.579,
+                                         73.387-1.828c39.543,21.55,63.262,88.035,28.693,124.25c-26.877,
+                                         28.159-70.322,42.289-106.697,53.2c38.424-9.629,113.958-23.235,
+                                         152.846-30.841c-1.332,0.242-50.691,7.187-50.609,4.999c0.119-3.09,
+                                         18.972-15.424,21.875-19.291c11.068-14.748,16.668-24.711,
+                                         20.083-42.706c2.618-13.781,2.204-20.9,2.036-28.498C261.865,
+                                         95.509,258.881,86.031,254.879,72.529z"/>
+        </ui:box>
+//ibex.log.error($yermom.path);
+        <ui:box fill="green" rowspan="2" minwidth="100" id="foo"/>
+        <ui:box fill="red" minwidth="50" minheight="100" />
+        <ui:box fill="pink" cols="5" height="100">
+            <ui:box height="10" colspan="5"/>
+            <ui:box width="10"/>
+            <ui:box height="10" fill="white" maxwidth="100"/>
+            <ui:box height="10" fill="black" colspan="2" minwidth="100"/>
+            <ui:box width="10"/>
+        </ui:box>
+        <ui:box fill="purple" minwidth="70" minheight="50"/>
+        <ui:box fill="yellow" colspan="2"/>
+    </ui:box>
+
+</ui:box>
+</ui:box>
+
+</ui:box>
+</ibex>
diff --git a/tests/main.t b/tests/main.t
new file mode 100644 (file)
index 0000000..c34797c
--- /dev/null
@@ -0,0 +1,26 @@
+<ibex xmlns:ui="ibex://ui">
+    <ui:box minwidth="1300" minheight="1300" fill="blue" cols="1" axis="x">
+
+        // make this box a top-level window
+        ibex.ui.frame = thisbox;
+
+        // this thread makes things spin.
+        var rot = 0;
+        ibex.thread = function(f) {
+            while(true) {
+                $lam.transform = "rotate(" + (-2 * rot) + ")";
+                rot += 1;
+                ibex.thread.yield();
+            }
+        }
+
+       // an example of texturing a box; this also demonstrates a
+       // box that shrinks to the size of the path drawn inside it.
+
+       <ui:box id="lam" width="300" height="300" fill="green">
+          <mux axis="z" width="100" height="25" transform="translate(50,50) rotate(90)" fill="red"/>
+          <mux axis="z" width="200" height="25" transform="translate(-20,200)"/>
+       </ui:box>
+    </ui:box>
+</ibex>
+
diff --git a/tests/mux.t b/tests/mux.t
new file mode 100644 (file)
index 0000000..2156f0f
--- /dev/null
@@ -0,0 +1,9 @@
+<ibex xmlns:ui="ibex://ui">
+  <ui:box fill="white">
+     var waiter = function() {
+         if (width==0 || height==0) { ibex.log.warn("wait"); ibex.thread = waiter; return; }
+         path = "M0,"+height+"H"+width+"L"+(width-(2/3)*height)+",0H"+height*(2/3)+"z";
+     }
+     ibex.thread = waiter;
+  </ui:box>
+</ibex>
\ No newline at end of file
diff --git a/tests/test2.t b/tests/test2.t
new file mode 100644 (file)
index 0000000..3dcc5e3
--- /dev/null
@@ -0,0 +1,43 @@
+<ibex xmlns:ui="ibex://ui">
+    <ui:box width="300" height="300" packed="false">
+        ibex.ui.frame = thisbox;
+
+        <ui:box fill="red" width="50" height="50" id="red" x="100" y="100" packed="false"/>
+
+        // this thread makes things spin.
+        var rot = 0;
+        ibex.thread = function(f) { while(true) {
+             ibex.thread.yield();
+//             if (ibex.math.floor(rot / 90) == rot / 90)
+//               $top.transform = "rotate(" + rot + ")";
+//             $bot.transform = "rotate(" + (-2 * rot) + ")";
+             $red.fill = "red";
+             ibex.thread.yield();
+             $red.fill = "green";
+             ibex.thread.yield();
+             rot += 1;
+       } }
+<!--
+        <ui:box fill="orange" colspan="2" minwidth="200" minheight="100" id="top" x="200" y="200"> 
+            <ui:box fill="green" width="100" height="18">
+                <ui:box stroke="black" strokecolor="black" height="18" width="100" text="booya"/>
+            </ui:box>
+        </ui:box>
+        <ui:box fill="green" rowspan="2" minwidth="100" id="foo"/>
+        <ui:box fill="red" minwidth="50" minheight="80" />
+        <ui:box fill="pink" cols="5" height="80">
+            <ui:box height="10" colspan="5"/>
+            <ui:box width="10"/>
+            <ui:box height="10" fill="white" maxwidth="100"/>
+            <ui:box height="10" fill="black" colspan="2" minwidth="100"/>
+            <ui:box width="10"/>
+        </ui:box>
+        <ui:box fill="purple" minwidth="70" minheight="50">
+            <ui:box shrink="true" fill="yellow" align="center" id="top">
+                <ui:box width="100" height="50" fill="red" id="bot"/>
+            </ui:box>
+        </ui:box>
+        <ui:box fill="yellow" colspan="2"/>
+-->
+    </ui:box>
+</ibex>
diff --git a/tests/test3.t b/tests/test3.t
new file mode 100644 (file)
index 0000000..e69deb1
--- /dev/null
@@ -0,0 +1,105 @@
+<ibex xmlns:ui="ibex://ui">
+    <ui:box maxwidth="600" maxheight="600" fill="white" align="center">
+        ibex.ui.frame = thisbox;
+
+
+        // this thread makes things spin.
+        var rot = 0;
+        ibex.thread = function(f) { while(true) {
+             ibex.thread.yield();
+             $top.transform = "rotate(" + rot + ")";
+             rot += 1;
+       } }
+
+<ui:box fill="blue" align="center">
+<ui:box fill="orange" align="center" shrink="true" id="oran">
+<ui:box cols="4" id="top" fill="#010101">
+        <ui:box rowspan="4" rows="3" hshrink="true">
+            <ui:box fill="#aaa" width="16" height="16" stroke="white">
+                <ui:box path="M0,0 L0,8 L8,8 z" fill="black" transform="rotate(135)" stroke="black"/>
+            </ui:box>
+            <ui:box fill="#444"/>
+            <ui:box fill="#aaa" width="16" height="16" stroke="white">
+                <ui:box path="M0,0 L0,8 L8,8 z" fill="black" transform="rotate(315)" stroke="black"/>
+            </ui:box>
+        </ui:box>
+        <ui:box fill="gray" colspan="2" minwidth="100" minheight="100" id="top">
+            <ui:box fill="black" strokecolor="white"
+                                   path="M54.779,81.835c0.847-40.317,56.096-73.716,90.263-80.415
+                                         C73.619-8.782-24.675,67.687,28.052,141.565c5.521,0.496,
+                                         27.86-3.54,35.385-7.49C58.134,124.452,50.103,105.064,54.779,81.835z
+                                         M182.513,43.781c-5.059-1.853-10.438-2.893-15.958-3.253c
+                                         30.715,25.152,45.28,84.093,15.454,115.339c-26.878,28.158
+                                         -70.323,42.289-106.696,53.2c38.424-9.63,77.214-18.643,
+                                         116.103-26.248c-1.333,0.242-13.949,2.594-13.866,0.404c0.12
+                                         -3.14,16.464-12.773,19.268-16.032c10.844-12.613,15.836
+                                         -17.482,20.586-33.194c5.553-18.364,7.831-45.911,1.675
+                                         -64.204C209.099,57.506,196.103,48.757,182.513,43.781z
+                                         M224.802,225.093c0.678,2.063,1.026,3.722,1.18,4.972C226.256
+                                         228.668,225.834,226.936,224.802,225.093z
+                                         M225.981,230.064c-0.005,0.028-0.008,0.057-0.016,0.085C
+                                         225.145,233.909,226.449,233.862,225.981,230.064z
+                                         M131.069,141.951C126.527,142.18,127.545,
+                                         145.066,131.069,141.951L131.069,141.951z
+                                         M232.061,200.168C233.102,199.979,233.319,
+                                         199.921,232.061,200.168L232.061,200.168z
+                                         M115.957,226.415C94.884,231.696,99.719,
+                                         231.287,115.957,226.415L115.957,226.415z
+                                         M75.313,209.067C54.24,214.349,59.074,
+                                         213.939,75.313,209.067L75.313,209.067z
+                                         M191.416,182.819C192.456,182.632,192.674,
+                                         182.573,191.416,182.819L191.416,182.819z
+                                         M182.679,172.652c-30.74-26.898-45.771-30.996-51.609-30.701c
+                                         -3.524,3.115-4.542,0.229,0,0c0.128-0.113,0.257-0.233,0.392
+                                         -0.361c8.591-8.261,8.921-16.852,10.243-23.791c1.322
+                                         -6.94-1.322-16.522-3.635-17.844c-2.314-1.322-3.967-2.313
+                                         -5.948-0.661c-1.982,1.652-1.321,13.218-6.939,15.531c
+                                         -5.617,2.312-12.887,15.861-23.13,19.166c-10.243,3.304-10.906,5.618
+                                         -10.574,1.322c0.331-4.295,1.652-5.618-3.636-10.906,5.618
+                                         -13.219c-5.287-7.598-3.964-4.957-6.277-4.625c-2.313,0.331
+                                         -5.288,21.147-4.957,24.122c0.332,2.975-46.922,0.992-49.896
+                                         -1.321c-2.974-2.313,7.6,17.183,2.313,19.826s2.644-0.991
+                                         -3.305,2.644c-5.948,3.634,5.948,8.261,3.965,12.888c
+                                         -1.983,4.625-13.548,27.095-14.539,27.095c-0.992,0-13.879,28.087
+                                         -14.54,31.062c-0.661,2.975,1.982,6.279,1.982,10.905c0,4.627
+                                         -0.33,8.921,0.992,11.565c1.321,2.643,4.295
+                                         ,0.66,4.295,0.66l0.331,0.661c0,0,20.157,0.991,2.974,1.321c
+                                         -17.183,0.332,16.192,4.297,22.801-1.982c6.608-6.277,3.634,3.305,18.174,0.331c14.539
+                                         -2.975-10.244,5.618,48.574
+                                         -37.009c58.819-42.628,2.645,10.572,18.835,61.131c16.19,50.557
+                                         -9.914,12.558,30.07-39.982c34.655-45.539,68.3159,50.557
+                                         -28.522,75.167-16.292C221.744,215.796,211.955,198.271,182.679,172.652zM69.668,175.627c
+                                         -2.313,2.312-7.931,7.6-14.54,4.956c
+                                         -6.608-2.645-5.618-1.652-0.991-6.939c4.626-5.287,
+                                         9.913-2.313,11.234-1.321C66.694,173.312,71.982,173.312,
+                                         69.668,175.627z
+                                         M254.879,72.529C234.197,22.545,175.4-5.017,128.489,
+                                         4.84C64.623,18.258,24.879,78.747,39.102,142.748c9.741,
+                                         5.756,27.901,8.985,39.01,7.227c6.266-0.992,1.361-6.12,
+                                         0.752-10.031c-1.874-12.023,1.284-25.218,4.006-36.861c5.815-24.87,
+                                         14.041-40.508,37.703-52.29c23.309-11.607,49.987-14.579,
+                                         73.387-1.828c39.543,21.55,63.262,88.035,28.693,124.25c-26.877,
+                                         28.159-70.322,42.289-106.697,53.2c38.424-9.629,113.958-23.235,
+                                         152.846-30.841c-1.332,0.242-50.691,7.187-50.609,4.999c0.119-3.09,
+                                         18.972-15.424,21.875-19.291c11.068-14.748,16.668-24.711,
+                                         20.083-42.706c2.618-13.781,2.204-20.9,2.036-28.498C261.865,
+                                         95.509,258.881,86.031,254.879,72.529z"/>
+        </ui:box>
+//ibex.log.error($yermom.path);
+        <ui:box fill="green" rowspan="2" minwidth="100" id="foo"/>
+        <ui:box fill="red" minwidth="50" minheight="100" />
+        <ui:box fill="pink" cols="5" height="100">
+            <ui:box height="10" colspan="5"/>
+            <ui:box width="10"/>
+            <ui:box height="10" fill="white" maxwidth="100"/>
+            <ui:box height="10" fill="black" colspan="2" minwidth="100"/>
+            <ui:box width="10"/>
+        </ui:box>
+        <ui:box fill="purple" minwidth="70" minheight="50"/>
+        <ui:box fill="yellow" colspan="2"/>
+    </ui:box>
+</ui:box>
+</ui:box>
+
+</ui:box>
+</ibex>