Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge Processing.js v1.4.0 into master

  • Loading branch information...
commit 02363398a823eae731cafa180a5581fe353397bf 2 parents 095ed41 + 0fd7b85
Jon Buckley jbuck authored
Showing with 2,638 additions and 814 deletions.
  1. +2 −1  AUTHORS
  2. +45 −0 CHANGELOG
  3. +6 −0 LICENSE
  4. +1 −2  README.md
  5. +51 −0 examples/seneca/Processing.reload/index.html
  6. +1 −0  examples/seneca/Processing.reload/sketch1.pde
  7. +1 −0  examples/seneca/Processing.reload/sketch2.pde
  8. +1 −0  examples/seneca/Processing.reload/sketch3.pde
  9. +1 −0  examples/seneca/Processing.reload/sketch4.pde
  10. +1 −0  examples/seneca/Processing.reload/sketch5.pde
  11. +1 −0  examples/seneca/Processing.reload/sketch6.pde
  12. +7 −0 examples/seneca/canvas properties/demo.pde
  13. +22 −0 examples/seneca/canvas properties/index.html
  14. +4 −0 examples/seneca/file and fragment loading (1818)/fafl.pde
  15. +25 −0 examples/seneca/file and fragment loading (1818)/index.html
  16. +25 −0 examples/seneca/fontcache (1741)/fontcache.pde
  17. +37 −0 examples/seneca/fontcache (1741)/index.html
  18. +86 −0 examples/seneca/inspection (1867)/index.html
  19. +0 −60 examples/seneca/pimage/pimageget.htm
  20. +0 −56 examples/seneca/pimage/pimageget.pjs
  21. +19 −0 examples/seneca/xml (1806)/index.html
  22. +5 −0 examples/seneca/xml (1806)/test.xml
  23. +157 −0 extensions/processing-inspector.js
  24. +8 −6 extensions/processing-lazyload.js
  25. +1,101 −602 processing.js
  26. +0 −2  test/KNOWN-FAILURES
  27. +6 −0 test/parser/ticket1688.pde
  28. +1 −1  test/perf/tests.js
  29. +1 −0  test/ref/additive-wave.pde
  30. +16 −3 test/ref/arc-fill-crisp.pde
  31. +1 −0  test/ref/array-objects.pde
  32. +1 −0  test/ref/bounce.pde
  33. +1 −0  test/ref/bouncy-bubbles.pde
  34. +1 −0  test/ref/brownian.pde
  35. +1 −0  test/ref/circle-collision.pde
  36. +1 −1  test/ref/color-wheel.pde
  37. +1 −0  test/ref/composite-objects.pde
  38. +1 −0  test/ref/conway.pde
  39. +10 −0 test/ref/curRectMode.pde
  40. +2 −2 test/ref/curveDetail.pde
  41. +1 −1  test/ref/empty-draw-3D.pde
  42. +2 −0  test/ref/flocking.pde
  43. +1 −5 test/ref/icosahedron.pde
  44. +1 −0  test/ref/increment-or-decrement.pde
  45. +48 −31 test/ref/index.html
  46. +1 −0  test/ref/inheritence.pde
  47. +1 −0  test/ref/integers-and-floats.pde
  48. +1 −0  test/ref/linear-image.pde
  49. +1 −0  test/ref/linear.pde
  50. +1 −0  test/ref/milliseconds.pde
  51. +1 −0  test/ref/moving-on-curves.pde
  52. +1 −0  test/ref/multiple-particle-systems.pde
  53. +1 −0  test/ref/noise-wave.pde
  54. +1 −0  test/ref/noise1d.pde
  55. +1 −0  test/ref/noise3d.pde
  56. +24 −0 test/ref/pgraphics.pde
  57. +56 −0 test/ref/pimage-get-and-place.pde
  58. +7 −0 test/ref/pimage-resize-bigger.pde
  59. +7 −0 test/ref/pimage-resize-smaller.pde
  60. +7 −0 test/ref/pimage-resize-x.pde
  61. +7 −0 test/ref/pimage-resize-y.pde
  62. +2 −4 test/ref/pixelarray.pde
  63. +8 −0 test/ref/point_3D_smooth.pde
  64. +10 −0 test/ref/point_3D_smooth_beginShape.pde
  65. +8 −0 test/ref/point_3D_smooth_hint_off.pde
  66. +29 −0 test/ref/point_3D_smooth_stroke.pde
  67. +1 −0  test/ref/pointillism.pde
  68. +1 −0  test/ref/polar-to-cartesian.pde
  69. +12 −0 test/ref/pshape_ellipseMode.pde
  70. +12 −0 test/ref/pshape_svg.pde
  71. +1 −0  test/ref/puff.pde
  72. +1 −0  test/ref/reflection.pde
  73. +1 −0  test/ref/reflection1.pde
  74. +1 −0  test/ref/reflection2.pde
  75. +1 −0  test/ref/rotate.pde
  76. +1 −5 test/ref/rotatepushpop.pde
  77. +1 −5 test/ref/rotatexy.pde
  78. +1 −0  test/ref/scale.pde
  79. +1 −0  test/ref/sequential.pde
  80. +10 −0 test/ref/shearx-3D.pde
  81. +11 −0 test/ref/shearx.pde
  82. +10 −0 test/ref/sheary-3D.pde
  83. +11 −0 test/ref/sheary.pde
  84. +1 −0  test/ref/simple-particle-system.pde
  85. +1 −0  test/ref/sine-and-cosine.pde
  86. +1 −0  test/ref/sine.pde
  87. +11 −9 test/ref/smoke-particle-system.pde
  88. +1 −0  test/ref/spore1.pde
  89. +22 −0 test/ref/svg-buffered.pde
  90. +30 −9 test/ref/tests.js
  91. +2 −2 test/ref/tint-isImageDirty.pde
  92. +1 −0  test/ref/translate.pde
  93. +15 −0 test/unit/XMLElement/P52.0/XMLAddChild.pde
  94. +17 −0 test/unit/XMLElement/P52.0/XMLAttribute/XMLAttributeGet.pde
  95. +10 −0 test/unit/XMLElement/P52.0/XMLAttribute/XMLAttributeRemove.pde
  96. +19 −0 test/unit/XMLElement/P52.0/XMLAttribute/XMLAttributeSet.pde
  97. +24 −0 test/unit/XMLElement/P52.0/XMLEquals.pde
  98. +20 −0 test/unit/XMLElement/P52.0/XMLGetChild.pde
  99. +21 −0 test/unit/XMLElement/P52.0/XMLGetChildNS.pde
  100. +22 −0 test/unit/XMLElement/P52.0/XMLInsertChild.pde
  101. +29 −0 test/unit/XMLElement/P52.0/XMLRemoveChild.pde
  102. +17 −0 test/unit/XMLElement/P52.0/XMLRemoveChildAtIndex.pde
  103. +21 −0 test/unit/XMLElement/P52.0/XMLgetChildCount.pde
  104. +10 −0 test/unit/XMLElement/P52.0/XMLgetContent.pde
  105. +1 −1  test/unit/XMLElement/XMLAttribute/XMLAttributeGet.pde
  106. +1 −1  test/unit/XMLElement/XMLAttribute/XMLAttributeRemove.pde
  107. +21 −0 test/unit/XMLElement/XMLElementGetChildNS.pde
  108. +8 −0 test/unit/XMLElement/XMLElementWithCDATA.pde
  109. +2 −2 test/unit/arrayCopy.pde
  110. +3 −0  test/unit/arrayList.pde
  111. +27 −0 test/unit/arrayListIndexing.pde
  112. +19 −0 test/unit/arrayListRemoveAll.pde
  113. +15 −0 test/unit/dollarSignCtor.pde
  114. +27 −0 test/unit/generics.pde
  115. +17 −0 test/unit/hashMapIteratorRemove.pde
  116. +2 −0  test/unit/hashmap-iterator.pde
  117. +37 −0 test/unit/methodargs.pde
  118. +25 −0 test/unit/pmatrix2d.pde
  119. +132 −0 test/unit/pmatrix3d.pde
  120. +25 −0 test/unit/splitTokens.pde
  121. +22 −0 test/unit/ticket1810.pde
  122. +3 −3 tools/fake-dom.js
3  AUTHORS
View
@@ -13,7 +13,7 @@ Mickael Medel
Matthew Lam
Jon Buckley
Dominic Baranski
-Elijah Grey
+Eli Grey
Thomas Saunders
Abel Allison
Andrew Grimo
@@ -33,3 +33,4 @@ Jonathan Brodsky
Roger Sodre
James Boelen
Michal Ejdys
+Greg Krilov
45 CHANGELOG
View
@@ -1,3 +1,48 @@
+July 31, 2012 - Release 1.4.0
+
+ * Added a PJS object inspector [#1867]
+ * Added ArrayList.lastIndexOf() [#1837]
+ * Added ArrayList.removeAll() [#1001]
+ * Added CDATA support to XML [#1788]
+ * Added check for IE9 non-HTML5 doctype [#1606]
+ * Added online global variable [#1743]
+ * Added option to stop ref test suite on failures [#1681]
+ * Added PFont cache limits [#1741]
+ * Added PImage.get() ref tests [#1601]
+ * Added point smoothing in 3D [#602]
+ * Added Processing.reload() [#1133]
+ * Added shearX() and shearX() to 2D mode [#1640]
+ * Added shearX() and shearY() in 3D mode [#1773]
+ * Added support for Processing 2.0 XML support [#1806]
+ * Added support for variable arguments [#1842]
+ * Added tinyLogLite license and author to LICENSE [#1731]
+ * Enabled preserveDrawingBuffer when context is acquired [#1651]
+ * Fixed array initialization code [#1817]
+ * Fixed ArrayList(int) constructor [#1829]
+ * Fixed data-processing-sources to seperate files or ids by whitespace, not just spaces [#1818]
+ * Fixed handling of namespaces in XMLElement.getChild [#1382]
+ * Fixed HashMap iterator.remove() bug [#1871]
+ * Fixed I-bar cursor appearing on click-dragging [#1755]
+ * Fixed IE9 hanging on exception without debugger [#1789]
+ * Fixed init to cache <script> elements [#1740]
+ * Fixed lazy loading height calculation [#1846]
+ * Fixed naming convention in shaders [#1279]
+ * Fixed off-by-one error in arc startLUT calculations [#1802]
+ * Fixed overloaded method calls [#1810]
+ * Fixed parser to allow $ in names [#1688]
+ * Fixed PGraphics initially not transparent [#1813]
+ * Fixed PImage.toImageData using cached image data [#1768]
+ * Fixed popStyle() setting rectMode() to undefined [#1771]
+ * Fixed PShape to work with PGraphics [#1778]
+ * Fixed PShape.shape() changing rectMode() and ellipseMode() [#1753]
+ * Fixed right-click context menu appearing in 3D sketches [#1779]
+ * Fixed splitTokens() to work with special characters [#1799]
+ * Fixed textSize() not resetting font metrics [#1687]
+ * Removed duplicate curElement assigned code [#1763]
+ * Set animated ref tests to run at 1000 FPS [#1830]
+ * Unmarked ref tests as known fails due to FF9 JIT bugs [#1700]
+ * Updated the generics regexp for array notation [#1812]
+
October 13, 2011 - Release 1.3.6
* Fixed arc() not filling the last half degree [#1717]
6 LICENSE
View
@@ -1,3 +1,4 @@
+Processing.js
Copyright (C) 2008 John Resig
Copyright (C) 2009-2011; see the AUTHORS file for authors and
copyright holders.
@@ -20,3 +21,8 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+tinylog lite JavaScript library
+Copyright (C) 2010 Eli Grey
+https://github.com/eligrey/tinylog
3  README.md
View
@@ -1,4 +1,3 @@
-
Processing.js - @VERSION@
=========================
a port of the Processing visualization language
@@ -134,7 +133,7 @@ Processing Developers at http://processingjs.org/reference/articles/p5QuickStart
JavaScript developers should start with the Processing.js Quick Start Guide for
JavaScript Developers at http://processingjs.org/reference/articles/jsQuickStart
-A more detailed guide is http://processingjs.org/reference/articles/PomaxGuide.
+A more detailed guide is http://processingjs.org/articles/PomaxGuide.html
A complete reference of all Processing.js functions and variables is available
at http://processingjs.org/reference.
51 examples/seneca/Processing.reload/index.html
View
@@ -0,0 +1,51 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Processing.reload() demonstrator</title>
+ <meta charset="utf-8">
+ <script type="text/javascript" src="../../../processing.js"></script>
+ <script type="text/javascript">
+ function swap_content() {
+ var html4 = '<p>sketch 4</p>'+"\n"+'<canvas id="sketch4" data-processing-sources="sketch4.pde"></canvas>' + "\n";
+ var html5 = '<p>sketch 5</p>'+"\n"+'<canvas id="sketch5" data-processing-sources="sketch5.pde"></canvas>' + "\n";
+ var html6 = '<p>sketch 6</p>'+"\n"+'<canvas id="sketch6" data-processing-sources="sketch6.pde"></canvas>' + "\n";
+ var html = html4 + html5 + html6;
+ document.getElementById('content').innerHTML = html;
+ Processing.reload();
+ }
+ </script>
+ </head>
+ <body>
+ <h1>Processing.reload()</h1>
+
+ <p>This example shows the use of Processing.reload(),
+ used to tell Processing to rescan the DOM for sketches
+ that should be loaded after DOM manipulations such as
+ swapping content in/out. Sketches are unloaded after
+ calling sketch.exit() on them, and their sketch bindings
+ are removed from Processing's instances list.</p>
+
+ <pre> &lt;script type="text/javascript"&gt;
+ function swap_content() {
+ var html = "&lt;... ... ...&gt;";
+ document.getElementById('content').innerHTML = html;
+ Processing.reload();
+ }
+ &lt;/script&gt;
+ &lt;input type="button" onclick="swap_content()"&gt;</pre>
+
+ <div id="content">
+ <p>sketch 1</p>
+ <canvas id="sketch1" data-processing-sources="sketch1.pde"></canvas>
+
+ <p>sketch 2</p>
+ <canvas id="sketch2" data-processing-sources="sketch2.pde"></canvas>
+
+ <p>sketch 3</p>
+ <canvas id="sketch3" data-processing-sources="sketch3.pde"></canvas>
+ </div>
+
+ <p>Press the button to swap the content for three different sketches</p>
+ <input type="button" value="swap" onclick="swap_content()">
+ </body>
+</html>
1  examples/seneca/Processing.reload/sketch1.pde
View
@@ -0,0 +1 @@
+text("1",50,50);
1  examples/seneca/Processing.reload/sketch2.pde
View
@@ -0,0 +1 @@
+text("2",50,50);
1  examples/seneca/Processing.reload/sketch3.pde
View
@@ -0,0 +1 @@
+text("3",50,50);
1  examples/seneca/Processing.reload/sketch4.pde
View
@@ -0,0 +1 @@
+text("4",50,50);
1  examples/seneca/Processing.reload/sketch5.pde
View
@@ -0,0 +1 @@
+text("5",50,50);
1  examples/seneca/Processing.reload/sketch6.pde
View
@@ -0,0 +1 @@
+text("6",50,50);
7 examples/seneca/canvas properties/demo.pde
View
@@ -0,0 +1,7 @@
+cursor(CROSS);
+void setup() { size(100,100); noLoop(); }
+void draw() { background(0,0,200); }
+void mousePressed() { println("mouse pressed"); }
+void mouseDragged() { println("mouse dragged"); }
+void mouseReleased() { println("mouse released"); }
+void mouseClicked() { println("mouse clicked"); }
22 examples/seneca/canvas properties/index.html
View
@@ -0,0 +1,22 @@
+<!doctype html>
+<html>
+ <head>
+ <title>Canvas properties explanation</title>
+ <script type="text/javascript" src="../../../processing.js"></script>
+ </head>
+ <body>
+
+ <h1>Canvas properties</h1>
+
+ <p>By default any element that is tab-focussable (via tabindex)
+ gets an outline rendered by certain browsers. We turn this outline
+ off for canvas, by setting the canvas's style property "outline: none".
+ We also disable the onmousedown handler and text-select properties so
+ that the canvas does not count as a text-selectable item. Click-dragging
+ the canvas will not show the typical I-bar cursor associated with
+ text selection, and double clicking the canvas will not select it
+ as if it was a text element.</p>
+
+ <canvas data-processing-sources="demo.pde"></canvas>
+ </body>
+</html>
4 examples/seneca/file and fragment loading (1818)/fafl.pde
View
@@ -0,0 +1,4 @@
+void setup() {
+ size(400,400);
+ noLoop();
+}
25 examples/seneca/file and fragment loading (1818)/index.html
View
@@ -0,0 +1,25 @@
+<!doctype html>
+<html>
+<head>
+ <title>File and fragment loading test (ticket 1818)</title>
+ <script type="text/javascript" src="../../../processing.js"></script>
+ <script type="text/processing" id="customcode">
+ void draw() {
+ background(255,255,100);
+ fill(0);
+ textAlign(CENTER);
+ text("custom code inclusion worked", width/2, height/2);
+ }
+ </script>
+</head>
+<body>
+
+ <h1>Mixed from-file and from-fragment loading of sketches</h1>
+
+ <p>This should show a yellowish sketch, with the text "custom code inclusion worked", centered.</p>
+
+ <canvas id="t1818test" data-processing-sources="fafl.pde
+ #customcode
+ "></canvas>
+</body>
+</html>
25 examples/seneca/fontcache (1741)/fontcache.pde
View
@@ -0,0 +1,25 @@
+void setup()
+{
+ size(200,200);
+ text("",0,0);
+}
+
+void draw()
+{
+ float ts = random(10,60);
+ textSize(ts);
+ fill(255,255,0,50);
+ rect(-1,-1,width+2,height+2);
+ fill(0);
+ float tw = textWidth("testing");
+ text("testing",(width-tw)/2,(height+ts/2)/2);
+
+ var cl = Processing.prototype.PFont.PFontCache.length;
+
+ var caching = Processing.prototype.PFont.prototype.caching || false;
+ if(!caching && cl) caching = "metrics only";
+ document.getElementById("cache").innerHTML = caching;
+
+ if(!cl) cl = "n/a";
+ document.getElementById("log").innerHTML = cl;
+}
37 examples/seneca/fontcache (1741)/index.html
View
@@ -0,0 +1,37 @@
+<html>
+ <head>
+ <title>fontcache</title>
+ <script type="text/javascript" src="../../../processing.js"></script>
+ <script type="text/javascript">
+ var sketch = null;
+ (function getSketch() {
+ sketch = Processing.getInstanceById('sketch');
+ if(!sketch) { setTimeout(getSketch, 500); }
+ else {
+ // ...
+ }}());
+ </script>
+ </head>
+ <body>
+
+ <h1>Font cache testing</h1>
+
+ <canvas id="sketch" data-processing-sources="fontcache.pde"></canvas>
+
+ <p>This test makes sure that even though a large number of
+ distinct font objects will be used, Processing.js switches
+ over from full font object caching to initial-metrics-only
+ caching when 50 fonts have been cached, turning off caching
+ entirely once the metrics-only font cache hits 400 fonts.</p>
+
+ <p>The test is performed by having a sketch use a textSize(random(10,60)),
+ which allows for 501 distinct font name/size pairs to be cached, due to
+ font sizes being rounded to a single decimal value. As such even though
+ one font is used, its possible size values 10.0, 10.1, ... , 59.9, 60.0
+ leads to 501 possible pairs.</p>
+
+ <div>caching: <span id="cache"></span></div>
+
+ <div>cache size: <span id="log"></span></div>
+ </body>
+</html>
86 examples/seneca/inspection (1867)/index.html
View
@@ -0,0 +1,86 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Processing inspector extension test</title>
+ <script type="text/javascript" src="../../../processing.js"></script>
+ <script type="text/javascript" src="../../../extensions/processing-inspector.js"></script>
+</head>
+<body>
+ <h1>Processing Inspector</h1>
+
+ <h3>number spinners should be continuously updated. spin them to see the line change.
+ click sketch to pause, allowing spinner updates. click sketch again to release monitored
+ values (changing them still affects sketch, but sketch no longer affects them).</h3>
+
+ <script type="text/processing">
+ class A {
+ float x=0, y=0;
+ void setX(float v) { x = v; }
+ void setY(float v) { y = v; }
+ }
+
+ class B extends A {}
+
+ class C extends B {
+ String printThis() { return x + "/" + y; }
+ }
+
+ C test;
+ C getTest() { return test; }
+
+ void setup() {
+ size(100,100);
+ test = new C();
+ test.setX(40);
+ test.setY(0);
+ stroke(0);
+ }
+
+ float step = PI/20;
+ void draw() {
+ background(240);
+ float x = test.x,
+ y = test.y;
+ float nx = x * cos(step) - y * sin(step),
+ ny = x * sin(step) + y * cos(step);
+ test.setX(nx);
+ test.setY(ny);
+ line(width/2, height/2, width/2 + test.x, height/2 + test.y);
+ }
+
+ boolean unbind = false;
+ void mousePressed() {
+ if(!unbind) {
+ unbind = true;
+ noLoop();
+ }
+ else {
+ loop();
+ ProcessingInspector.release(test, "x");
+ ProcessingInspector.release(test, "y");
+ }
+ }
+
+ // processing.js event handling
+ onload = function() {
+ var xControl = document.getElementById('x_control');
+ xControl.onchange = function() { test.x = this.value; redraw(); }
+ var callback = function(obj, attr, val) { xControl.value = val|0; };
+ ProcessingInspector.monitor(test, "x", callback);
+
+ var yControl = document.getElementById('y_control');
+ yControl.onchange = function() { test.y = this.value; redraw(); }
+ callback = function(obj, attr, val) { yControl.value = val|0; };
+ ProcessingInspector.monitor(test, "y", callback);
+ }
+ </script>
+ <canvas></canvas>
+
+ <div>
+ <input id="x_control" type="number" min="-100" max="100" step="1">
+ <input id="y_control" type="number" min="-100" max="100" step="1">
+ </div>
+
+</body>
+</html>
60 examples/seneca/pimage/pimageget.htm
View
@@ -1,60 +0,0 @@
-<script src="../../../processing.js"></script>
-<canvas datasrc="pimageget.pjs" width="200" height="200"></canvas>
-<pre>
-size(200,250);
-background(0);
-PImage greenSquare = createImage(100, 100, ARGB);
-for (int i = 0; i < greenSquare.pixels.length; i++) {
- // make greenSquare green
- greenSquare.pixels[i] = color(0,255,0);
-}
- println(color(0,255,0));
-image(greenSquare, 0, 0);
-PImage blueSquare = createImage(100, 100, ARGB);
-for (int i = 0; i < blueSquare.pixels.length; i++) {
- // make blueSquare blue
- blueSquare.pixels[i] = color(0,0,255);
-}
-image(blueSquare, 100, 0);
-
-// draw red square inside green then get() and put it in blue
-PImage redSquare = createImage(40,40,ARGB);
-for (int i = 0; i < redSquare.pixels.length; i++) {
- // make redSquare red
- redSquare.pixels[i] = color(255,0,0);
-}
-image(redSquare,30,30);
-
-PImage getRedSquare = createImage(40,40,ARGB);
-getRedSquare = get(30,30,40,40);
-image(getRedSquare, 130,30);
-
-PImage testGet4arg = createImage(100,40,ARGB);
-testGet4arg = get(50,30,100,40);
-image(testGet4arg, 50,100);
-
-PImage testGet5arg = createImage(100,40,ARGB);
-testGet5arg = testGet4arg.get(0,0,100,40);
-image(testGet4arg, 50,150);
-
-int testGet3arg = 0;
-testGet3arg = testGet4arg.get(40,0);
-
-int testGet2arg = 0;
-testGet2arg = get(150,45);
-
-PImage testGet1arg = createImage(100,40,ARGB);
-testGet1arg = testGet4arg.get();
-image(testGet1arg, 50,200);
-
-PImage testGet0arg = createImage(100,40,ARGB);
-testGet0arg = get(100,50,100,40);
-image(testGet0arg, 0,50);
-
-println("createImage() makes the green square, blue square, and the red square inside the green square.");
-println("image() places the green red and blue squares.");
-println("getRedSquare is created by calling get(x,y,w,h) on the coordinates of where redSquare was placed");
-println("image() places getRedSquare inside blue. no green pixels are copied");
-println(testGet3arg + " is returned from PImage.get(40,0) should be -16711936 (green)");
-println(testGet2arg + " is returned from get(150,45) should be -65536 (red)");
-</pre>
56 examples/seneca/pimage/pimageget.pjs
View
@@ -1,56 +0,0 @@
-size(200,250);
-background(0);
-PImage greenSquare = createImage(100, 100, ARGB);
-for (int i = 0; i < greenSquare.pixels.length; i++) {
- // make greenSquare green
- greenSquare.pixels[i] = color(0,255,0);
-}
- println(color(0,255,0));
-image(greenSquare, 0, 0);
-PImage blueSquare = createImage(100, 100, ARGB);
-for (int i = 0; i < blueSquare.pixels.length; i++) {
- // make blueSquare blue
- blueSquare.pixels[i] = color(0,0,255);
-}
-image(blueSquare, 100, 0);
-
-// draw red square inside green then get() and put it in blue
-PImage redSquare = createImage(40,40,ARGB);
-for (int i = 0; i < redSquare.pixels.length; i++) {
- // make redSquare red
- redSquare.pixels[i] = color(255,0,0);
-}
-image(redSquare,30,30);
-
-PImage getRedSquare = createImage(40,40,ARGB);
-getRedSquare = get(30,30,40,40);
-image(getRedSquare, 130,30);
-
-PImage testGet4arg = createImage(100,40,ARGB);
-testGet4arg = get(50,30,100,40);
-image(testGet4arg, 50,100);
-
-PImage testGet5arg = createImage(100,40,ARGB);
-testGet5arg = testGet4arg.get(0,0,100,40);
-image(testGet4arg, 50,150);
-
-int testGet3arg = 0;
-testGet3arg = testGet4arg.get(40,0);
-
-int testGet2arg = 0;
-testGet2arg = get(150,45);
-
-PImage testGet1arg = createImage(100,40,ARGB);
-testGet1arg = testGet4arg.get();
-image(testGet1arg, 50,200);
-
-PImage testGet0arg = createImage(100,40,ARGB);
-testGet0arg = get(100,50,100,40);
-image(testGet0arg, 0,50);
-
-println("createImage() makes the green square, blue square, and the red square inside the green square.");
-println("image() places the green red and blue squares.");
-println("getRedSquare is created by calling get(x,y,w,h) on the coordinates of where redSquare was placed");
-println("image() places getRedSquare inside blue. no green pixels are copied");
-println(testGet3arg + " is returned from PImage.get(40,0) should be -16711936 (green)");
-println(testGet2arg + " is returned from get(150,45) should be -65536 (red)");
19 examples/seneca/xml (1806)/index.html
View
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Processing.js test of trim()</title>
+ <script type="text/javascript" src="../../../processing.js"></script>
+</head>
+<body>
+ <h1>P5 2.0 loadXML test</h1>
+
+ <p>This test tries to load <a href="test.xml">test.xml</a> as an XML object</p>
+
+ <script type="text/processing">
+ XML xml = loadXML("test.xml");
+ println(xml);
+ </script>
+ <canvas></canvas>
+</body>
+</html>
5 examples/seneca/xml (1806)/test.xml
View
@@ -0,0 +1,5 @@
+<?xml version='1.0'?>
+<websites>
+ <site id='0' url='processing.org'>Processing</site>
+ <site id='1' url='mobile.processing.org'>Processing Mobile</site>
+</websites>
157 extensions/processing-inspector.js
View
@@ -0,0 +1,157 @@
+/*
+
+ I N S P E C T O R F O R P R O C E S S I N G . J S
+
+ Part of the Processing.js project
+
+ License : MIT
+ Web Site : http://processingjs.org
+ Github Repo. : http://github.com/jeresig/processing-js
+ Bug Tracking : http://processing-js.lighthouseapp.com
+
+*/
+if (typeof ProcessingInspector === "undefined") {
+ ProcessingInspector = (function() {
+ var releaseFunctor = "__release__",
+ monitorCount = "__monitor_count_",
+
+ /**
+ * To prevent magic strings, we
+ */
+ getMonitoredAttrName = function(attr) {
+ return "__monitored+"+attr+"__";
+ },
+
+ /**
+ * Determine whether this object owns or inherits
+ * the indicated attribute property. If it owns
+ * it, its property descriptor with have a "value"
+ * property that contains the actual value.
+ */
+ hasValueProperty = function(object, attr, forRelease) {
+ if (forRelease) {
+ attr = getMonitoredAttrName(attr);
+ }
+ var propDesc = Object.getOwnPropertyDescriptor(object, attr);
+ if (!propDesc) {
+ return false;
+ }
+ return "value" in Object.getOwnPropertyDescriptor(object, attr);
+ },
+
+ /**
+ * Get the top-level object that actually holds
+ * the attribute we're interested in.
+ */
+ getOwner = function(object, attr, forRelease) {
+ if (!(attr in object)) {
+ // shortcut: unsupported property
+ return false;
+ }
+ if (hasValueProperty(object, attr, forRelease)) {
+ // shortcut: property owned by this object
+ return object;
+ }
+ if (object.$super) {
+ // normal lookup: find owner and return
+ while (!hasValueProperty(object, attr, forRelease)) {
+ object = object.$super;
+ }
+ return object;
+ }
+ // reasonably, we can't get here, but you never know.
+ return false;
+ },
+
+ /**
+ * Stop monitoring an object's property.
+ */
+ releaseFunction = function(attr) {
+ // remove getter/setter again
+ var monitoredAttr = getMonitoredAttrName(attr);
+ delete(this[attr]);
+ var props = {
+ configurable: true,
+ enumerable: true,
+ writable: true,
+ value: this[monitoredAttr] };
+ Object.defineProperty(this, attr, props);
+ delete(this[monitoredAttr]);
+ };
+
+ /**
+ * We return an object with a monitor() and release() function.
+ */
+ return {
+
+ /**
+ * Start monitoring a specific property on a Pjs object for changes.
+ *
+ * @param object The object to monitor
+ * @param attr the property to monitor changes for
+ * @param callback a callback function with signature (obj,attr,val) that gets called on changes
+ */
+ monitor: function(object, attr, callback) {
+ // can we even monitor this object's attribute?
+ object = getOwner(object, attr, false);
+ if (object === false) {
+ return false;
+ }
+
+ // we can. 1) kill off property,
+ var monitoredAttr = getMonitoredAttrName(attr);
+ object[monitoredAttr] = object[attr];
+ delete(object[attr]);
+
+ // 2) Lift up this property using a closure,
+ props = (function(attr, monitorAttr) {
+ props = {
+ get : function() { return this[monitoredAttr]; },
+ set : function(v) {
+ if (v != this[monitoredAttr]) {
+ this[monitoredAttr] = v;
+ callback(object, attr, v);
+ }
+ },
+ configurable : true,
+ enumerable : true };
+ return props;
+ }(attr, monitoredAttr));
+ Object.defineProperty(object, attr, props);
+
+ // 3) (set and) increment the monitored value count,
+ if (!hasValueProperty(object, monitorCount, false)) {
+ object[monitorCount] = 0;
+ }
+ object[monitorCount]++;
+
+ // 4) (re)bind the releasing function.
+ object[releaseFunctor] = releaseFunction;
+ },
+
+ /**
+ * We should be able to release monitored objects
+ * at will, provided they can be released.
+ *
+ * @param object The object to monitor
+ * @param attr the property to monitor changes for
+ */
+ release: function(object, attr) {
+ // restore the property as "Writable value"
+ object = getOwner(object, attr, true);
+ if (object[releaseFunctor]) {
+ object[releaseFunctor](attr);
+ object[monitorCount]--;
+ }
+ // clean up if this was the last monitored property
+ if (object[monitorCount] === 0) {
+ delete(object[releaseFunctor]);
+ delete(object[monitorCount]);
+ }
+ }
+ };
+ }());
+}
+else if (window && window.console && window.console.log) {
+ window.console.log("ERROR: ProcessingInspector already exists.");
+}
14 extensions/processing-lazyload.js
View
@@ -75,15 +75,17 @@
/**
* General purpose "height of element on page" function.
+ * Code from http://www.quirksmode.org/js/findpos.html
* @param {HTMLElement} element The HTML element for which the height on the page is being checked
*/
- var getElementPosition = function(element) {
- var height = 0;
- while (element && element.offsetTop) {
- height += element.offsetTop;
- element = element.parentNode;
+ var getElementPosition = function(obj) {
+ var curTop = 0;
+ if (obj.offsetParent) {
+ do {
+ curTop += obj.offsetTop;
+ } while (!!(obj = obj.offsetParent));
}
- return height;
+ return curTop;
};
/**
1,703 processing.js
View
1,101 additions, 602 deletions not shown
2  test/KNOWN-FAILURES
View
@@ -11,7 +11,5 @@ test/parser/Processing-Book-001/Units 31-42/40 Image 5/_11/_11.pde
test/parser/Fry-Visualizing-Data/ch08-graphlayout/step_08c_graphviz/step_08c_graphviz.pde
test/parser/Processing-Book-001/Units 43-51/45 Output 2/_04/_04.pde
test/parser/Processing-Book-001/Units 43-51/45 Output 2/_05/_05.pde
-# Known issue with overloaded methods
-test/unit/overloadedMethodCall.pde
# Uses code that isn't even supported by Processing
test/parser/Processing-Book-001/Extensions/Mobile/_07/_07.pde
6 test/parser/ticket1688.pde
View
@@ -0,0 +1,6 @@
+int pixels$pixels = 200;
+
+void setup() {
+ size(pixels$pixels, pixels$pixels, P2D);
+ noLoop();
+}
2  test/perf/tests.js
View
@@ -88,7 +88,7 @@ var tests = [
{ path: "background-3D.pde", tags: ["3D"] },
{ path: "box-3D.pde", tags: ["3D"] },
{ path: "box-noFill-3D.pde", tags: ["3D"] },
- { path: "box-noStroke-3D.pde", tags: ["3D"] },
+ { path: "box-nostroke-3D.pde", tags: ["3D"] },
{ path: "sphere-3D.pde", tags: ["3D"] },
{ path: "sphere-noFill-3D.pde", tags: ["3D"] },
{ path: "triangle-3D.pde", tags: ["3D"] },
1  test/ref/additive-wave.pde
View
@@ -13,6 +13,7 @@ float[] yvalues; // Using an array to store height val
void setup() {
size(100,100);
+ frameRate(1000);
colorMode(RGB,255,255,255,100);
smooth();
w = width+8;
19 test/ref/arc-fill-crisp.pde
View
16 additions, 3 deletions not shown
1  test/ref/array-objects.pde
View
@@ -7,6 +7,7 @@ Module[] mods;
void setup()
{
size(100, 100);
+ frameRate(1000);
background(176);
noStroke();
randomSeed(42);
1  test/ref/bounce.pde
View
@@ -13,6 +13,7 @@ int ydirection = 1; // Top to Bottom
void setup()
{
size(100, 100);
+ frameRate(1000);
noStroke();
smooth();
// Set the starting position of the shape
1  test/ref/bouncy-bubbles.pde
View
@@ -8,6 +8,7 @@ Ball[] balls = new Ball[numBalls];
void setup()
{
size(100, 100);
+ frameRate(1000);
noStroke();
smooth();
randomSeed(42);
1  test/ref/brownian.pde
View
@@ -10,6 +10,7 @@ float[] ay = new float[num];
void setup()
{
size(100, 100);
+ frameRate(1000);
for(int i=0; i<num; i++) {
ax[i] = width/2;
ay[i] = height/2;
1  test/ref/circle-collision.pde
View
@@ -12,6 +12,7 @@ Vect2D[] vels = {
void setup(){
size(100, 100);
+ frameRate(1000);
smooth();
noStroke();
}
2  test/ref/color-wheel.pde
View
1 addition, 1 deletion not shown
1  test/ref/composite-objects.pde
View
@@ -5,6 +5,7 @@ EggRing er1, er2;
void setup()
{
size(100, 100);
+ frameRate(1000);
smooth();
er1 = new EggRing(33, 66, 0.1, 33);
er2 = new EggRing(66, 90, 0.05, 66);
1  test/ref/conway.pde
View
@@ -7,6 +7,7 @@ int[][][] world;
void setup()
{
size(100, 100);
+ frameRate(1000);
sx = width;
sy = height;
world = new int[sx][sy][2];
10 test/ref/curRectMode.pde
View
10 additions, 0 deletions not shown
4 test/ref/curveDetail.pde
View
2 additions, 2 deletions not shown
2  test/ref/empty-draw-3D.pde
View
1 addition, 1 deletion not shown
2  test/ref/flocking.pde
View
@@ -4,6 +4,8 @@
Flock flock;
void setup() {
+ size(100, 100);
+ frameRate(1000);
colorMode(RGB,255,255,255,100);
randomSeed(42);
6 test/ref/icosahedron.pde
View
@@ -14,8 +14,6 @@ void setup(){
ico3 = new Icosahedron(12);
}
-iterations = 0;
-
void draw(){
background(0);
lights();
@@ -47,9 +45,7 @@ void draw(){
ico3.create();
popMatrix();
- iterations++;
-
- if (iterations == 25) {
+ if (frameCount == 25) {
exit();
}
}
1  test/ref/increment-or-decrement.pde
View
@@ -9,6 +9,7 @@ boolean direction;
void setup()
{
size(100, 100);
+ frameRate(1000);
colorMode(RGB, width);
a = 0;
b = width;
79 test/ref/index.html
View
@@ -16,27 +16,29 @@
<h3>Settings</h3>
<div>Run Tests:
- <select id="test-type" onchange="updateSelectedTests();">
- <option value="2D,3D" selected>2D and 3D</option>
- <option value="2D">2D Only</option>
- <option value="3D">3D Only</option>
- <option value="BLEND">Blend Only</option>
- <option value="Color Profile">Color Profile</option>
- <option value="endShape2D">endShape2D</option>
- <option value="endShape3D">endShape3D</option>
- <option value="Calibration">Calibration</option>
- <option value="Convolution">Convolution</option>
- <option value="SVG">SVG</option>
- <option value="Text">Text</option>
- <option value="Crisp">Crisp</option>
- <option value="Test Suite">Test Suite</option>
- </select>
- Blur Radius: <input type="text" size="2" id="sigma" onchange="updateTolerance();">
- Epsilon (0-1.0): <input type="text" size="4" id="epsilon" onchange="updateTolerance();">
- Remove Passed Tests: <input id="remove-passed" type="checkbox">
- <input onclick="runTests(selectedTests);" type="button" value="Start">
- <span id="testCount"></span>
- </div>
+ <select id="test-type" onchange="updateSelectedTests();">
+ <option value="2D,3D" selected>2D and 3D</option>
+ <option value="2D">2D Only</option>
+ <option value="3D">3D Only</option>
+ <option value="BLEND">Blend Only</option>
+ <option value="Color Profile">Color Profile</option>
+ <option value="endShape2D">endShape2D</option>
+ <option value="endShape3D">endShape3D</option>
+ <option value="Calibration">Calibration</option>
+ <option value="Convolution">Convolution</option>
+ <option value="SVG">SVG</option>
+ <option value="Text">Text</option>
+ <option value="Crisp">Crisp</option>
+ <option value="Test Suite">Test Suite</option>
+ </select>
+ Blur Radius: <input type="text" size="2" id="sigma" onchange="updateTolerance();">
+ Epsilon (0-1.0): <input type="text" size="4" id="epsilon" onchange="updateTolerance();">
+ Remove Passed Tests: <input id="remove-passed" type="checkbox">
+ Stop on First Fail: <input id="stop-on-fail" type="checkbox">
+ <input id="testStart" onclick="runTests(selectedTests);" type="button" value="Start">
+ <input id="testStop" onclick="endTests();" type="button" value="Stop" style="display:none">
+ <span id="testCount"></span>
+ </div>
<h3>Results</h3>
<div id="status" style="margin-bottom: 10px;"></div>
@@ -65,6 +67,7 @@
var total = document.getElementById('total');
total.innerHTML = '';
var removePassed;
+ var stopTests;
updateSelectedTests();
@@ -183,7 +186,16 @@
}
}
+ function endTests(){
+ document.getElementById('testStart').style.display="inline";
+ document.getElementById('testStop').style.display="none";
+ stopTests = true;
+ }
+
function runTests(tests) {
+ stopTests = false;
+ document.getElementById('testStart').style.display="none";
+ document.getElementById('testStop').style.display="inline";
var results = document.getElementById('results');
results.innerHTML = '';
var total = document.getElementById('total');
@@ -213,12 +225,12 @@
try {
if (isWebGL) {
var context = aCanvas.getContext("experimental-webgl");
-
+
var data = null;
try{
// try deprecated way first
data = context.readPixels(0, 0, aCanvas.width, aCanvas.height, context.RGBA, context.UNSIGNED_BYTE);
-
+
// Chrome posts an error
if(context.getError()){
throw new Error("readPixels() API has changed.");
@@ -241,23 +253,28 @@
var passedCount = 0, failedCount = 0, knownFailedCount = 0, tl = tests.length;
function nextTest(testNum) {
- if (testNum < tl) {
+ if (document.getElementById('stop-on-fail').checked && failedCount){
+ endTests();
+ }
+
+ if (!stopTests && testNum < tl) {
window.setTimeout(function() { runOne(testNum); }, 10);
} else {
+ endTests();
var info = "Tests Completed - " + failedCount + " failed, " + knownFailedCount + " known failures, " + passedCount + " passed, " + (failedCount + passedCount + knownFailedCount) + " total.";
document.getElementById('status').innerHTML = info;
total.innerHTML = info;
-
+
// sort the tests into failed, known failures, and passed
var failedDiv = document.createElement('div');
failedDiv.innerHTML = '<hr><h3>Failed ' + failedCount + ' of ' + (passedCount + failedCount + knownFailedCount) + '</h3>';
-
+
var knownFailureDiv = document.createElement('div');
knownFailureDiv.innerHTML = '<hr><h3>Known Failures ' + knownFailedCount + ' of ' + (passedCount + failedCount + knownFailedCount) + '</h3>';
-
+
var passDiv = document.createElement('div');
passDiv.innerHTML = '<hr><h3>Passed ' + passedCount + ' of ' + (passedCount + failedCount + knownFailedCount) + '</h3>';
-
+
while (results.hasChildNodes()) {
var childNode = results.removeChild(results.firstChild);
if (childNode.className === 'failed') {
@@ -268,7 +285,7 @@
passDiv.appendChild(childNode);
}
}
-
+
if (failedCount < 1) {
var temp = document.createElement('p');
temp.innerHTML = 'No failed tests';
@@ -282,7 +299,7 @@
temp.innerHTML = 'No passed tests';
passDiv.appendChild(temp);
}
-
+
results.appendChild(failedDiv);
results.appendChild(knownFailureDiv);
results.appendChild(passDiv);
@@ -311,7 +328,7 @@
var original = buildCanvas(test.name + '-original', test.width, test.height);
var current = buildCanvas(test.name + '-current', test.width, test.height);
var diff = buildCanvas(test.name + '-diff', test.width, test.height);
-
+
result.appendChild(original);
result.appendChild(current);
result.appendChild(diff);
1  test/ref/inheritence.pde
View
@@ -6,6 +6,7 @@ SpinArm arm;
void setup()
{
size(100, 100);
+ frameRate(1000);
smooth();
arm = new SpinArm(width/2, height/2, 0.01);
spots = new SpinSpots(width/2, height/2, -0.02, 33.0);
1  test/ref/integers-and-floats.pde
View
@@ -8,6 +8,7 @@ float b = 0.0; // Create a variable "b" of the datatype "float"
void setup()
{
size(100, 100);
+ frameRate(1000);
stroke(255);
}
1  test/ref/linear-image.pde
View
@@ -12,6 +12,7 @@ float signal;
void setup()
{
size(100, 100);
+ frameRate(1000);
stroke(255);
a = loadImage("arch-100.png");
1  test/ref/linear.pde
View
@@ -5,6 +5,7 @@ float a = 5;
void setup()
{
size(100, 100);
+ frameRate(1000);
stroke(255);
}
1  test/ref/milliseconds.pde
View
@@ -5,6 +5,7 @@ float scale;
void setup()
{
size(100, 100);
+ frameRate(1000);
noStroke();
scale = width/10;
randomSeed(42);
1  test/ref/moving-on-curves.pde
View
@@ -16,6 +16,7 @@ void setup()
{
background(0);
size(100, 100);
+ frameRate(1000);
noStroke();
smooth();
distX = endX - beginX;
1  test/ref/multiple-particle-systems.pde
View
@@ -5,6 +5,7 @@ ArrayList psystems;
void setup() {
size(100, 100);
+ frameRate(1000);
colorMode(RGB, 255, 255, 255, 100);
psystems = new ArrayList();
randomSeed(42);
1  test/ref/noise-wave.pde
View
@@ -10,6 +10,7 @@ float[] yvalues; // Using an array to store height values for the wave
void setup() {
size(100,100);
+ frameRate(1000);
noiseSeed(2011);
colorMode(RGB,255,255,255,100);
smooth();
1  test/ref/noise1d.pde
View
@@ -7,6 +7,7 @@ float xincrement = 0.01;
void setup() {
size(100,100);
+ frameRate(1000);
background(0);
smooth();
noStroke();
1  test/ref/noise3d.pde
View
@@ -8,6 +8,7 @@ float zincrement = 0.08;
void setup() {
size(100,100);
+ frameRate(1000);
noiseSeed(42);
}
24 test/ref/pgraphics.pde
View
24 additions, 0 deletions not shown
56 test/ref/pimage-get-and-place.pde
View
56 additions, 0 deletions not shown
7 test/ref/pimage-resize-bigger.pde
View
7 additions, 0 deletions not shown
7 test/ref/pimage-resize-smaller.pde
View
7 additions, 0 deletions not shown
7 test/ref/pimage-resize-x.pde
View
7 additions, 0 deletions not shown
7 test/ref/pimage-resize-y.pde
View
7 additions, 0 deletions not shown
6 test/ref/pixelarray.pde
View
@@ -6,21 +6,19 @@
PImage img;
int direction = 1;
float signal;
-int iterations = 0;
void setup() {
size(100, 100);
noFill();
stroke(255);
- frameRate(30);
+ frameRate(1000);
img = loadImage("berlin.png");
}
void draw() {
- if (iterations == 5) {
+ if (frameCount == 5) {
exit();
}
- iterations++;
if (signal > img.width*img.height-1 || signal < 0) {
direction = direction * -1;
8 test/ref/point_3D_smooth.pde
View
8 additions, 0 deletions not shown
10 test/ref/point_3D_smooth_beginShape.pde
View
10 additions, 0 deletions not shown
8 test/ref/point_3D_smooth_hint_off.pde
View
8 additions, 0 deletions not shown
29 test/ref/point_3D_smooth_stroke.pde
View
29 additions, 0 deletions not shown
1  test/ref/pointillism.pde
View
@@ -8,6 +8,7 @@ void setup()
{
a = loadImage("eames.png");
size(100,100);
+ frameRate(1000);
noStroke();
background(255);
smooth();
1  test/ref/polar-to-cartesian.pde
View
@@ -11,6 +11,7 @@ float theta_acc;
void setup() {
size(100,100);
+ frameRate(1000);
smooth();
// Initialize all values
12 test/ref/pshape_ellipseMode.pde
View
12 additions, 0 deletions not shown
12 test/ref/pshape_svg.pde
View
12 additions, 0 deletions not shown
1  test/ref/puff.pde
View
@@ -18,6 +18,7 @@ float[]cellRadius = new float[cells];
void setup(){
background(0);
size(100, 100);
+ frameRate(1000);
// begin in the center
headX = width/2;
headY = height/2;
1  test/ref/reflection.pde
View
@@ -3,6 +3,7 @@
void setup() {
size(100, 100, P3D);
+ frameRate(1000);
noStroke();
colorMode(RGB, 1);
fill(0.4);
1  test/ref/reflection1.pde
View
@@ -10,6 +10,7 @@ float velocityX, velocityY;
void setup(){
size(100, 100);
+ frameRate(1000);
fill(128);
smooth();
baseX1 = 0;
1  test/ref/reflection2.pde
View
@@ -9,6 +9,7 @@ float[] peakHeights = new float[segments+1];
void setup(){
size(100, 100);
+ frameRate(1000);
smooth();
randomSeed(42);
orb = new Orb(50, 50, 3);
1  test/ref/rotate.pde
View
@@ -3,6 +3,7 @@
void setup()
{
size(100,100);
+ frameRate(1000);
noStroke();
fill(255);
randomSeed(42);
6 test/ref/rotatepushpop.pde
View
@@ -20,8 +20,6 @@ void setup()
lights();
}
-int iterations = 0;
-
void draw()
{
background(0, 0, 26);
@@ -37,9 +35,7 @@ void draw()
popMatrix();
}
- iterations++;
-
- if (iterations == 60) {
+ if (frameCount == 60) {
exit();
}
}
6 test/ref/rotatexy.pde
View
@@ -12,8 +12,6 @@ void setup() {
fill(204, 204);
}
-iterations = 0;
-
void draw() {
background(126);
@@ -34,9 +32,7 @@ void draw() {
fill(0);
rect(-rSize, -rSize, rSize*2, rSize*2);
- iterations++;
-
- if (iterations == 100) {
+ if (frameCount == 100) {
exit();
}
}
1  test/ref/scale.pde
View
@@ -6,6 +6,7 @@ float s = 0.0;
void setup()
{
size(100,100);
+ frameRate(1000);
noStroke();
rectMode(CENTER);
}
1  test/ref/sequential.pde
View
@@ -9,6 +9,7 @@ PImage[] images = new PImage[numFrames];
void setup()
{
size(100, 100);
+ frameRate(1000);
frameRate(30);
images[0] = loadImage("PT_anim0000.gif");
10 test/ref/shearx-3D.pde
View
10 additions, 0 deletions not shown
11 test/ref/shearx.pde
View
11 additions, 0 deletions not shown
10 test/ref/sheary-3D.pde
View
10 additions, 0 deletions not shown
11 test/ref/sheary.pde
View
11 additions, 0 deletions not shown
1  test/ref/simple-particle-system.pde
View
@@ -4,6 +4,7 @@ ParticleSystem ps;
void setup() {
size(100,100);
+ frameRate(1000);
randomSeed(42);
colorMode(RGB,255,255,255,100);
ps = new ParticleSystem(1,new Vector3D(width/2,height/2,0));
1  test/ref/sine-and-cosine.pde
View
@@ -13,6 +13,7 @@ int sc = 40;
void setup()
{
size(100, 100);
+ frameRate(1000);
noStroke();
smooth();
}
1  test/ref/sine.pde
View
@@ -12,6 +12,7 @@ int rad_points = 90;
void setup()
{
size(100, 100);
+ frameRate(1000);
noStroke();
smooth();
}
20 test/ref/smoke-particle-system.pde
View
11 additions, 9 deletions not shown
1  test/ref/spore1.pde
View
@@ -12,6 +12,7 @@ color black = color(0, 0, 0);
void setup()
{
size(100, 100, P2D);
+ frameRate(1000);
randomSeed(42);
clearscr();
w = new World();
22 test/ref/svg-buffered.pde
View
22 additions, 0 deletions not shown
39 test/ref/tests.js
View
@@ -1,6 +1,6 @@
var tests = [
{ path: "stretch.pde", tags: ["3D"] },
- { path: "arc-fill-crisp.pde", tags: ["2D"], epsilonOverride: 0.07 },
+ { path: "arc-fill-crisp.pde", tags: ["2D"], epsilonOverride: 0.08 },
{ path: "mixture.pde", tags: ["3D"], knownFailureTicket: "1239" },
{ path: "mixturegrid.pde", tags: ["3D"], knownFailureTicket: "1239" },
{ path: "moveeye.pde", tags: ["3D"], epsilonOverride: 0.06 },
@@ -13,6 +13,9 @@ var tests = [
{ path: "perspective.pde", tags: ["3D"] },
{ path: "rotatepushpop.pde", tags: ["3D"] },
{ path: "rotatexy.pde", tags: ["3D"] },
+ { path: "curRectMode.pde", tags: ["2D"] },
+ { path: "shearx-3D.pde", tags: ["3D"] },
+ { path: "sheary-3D.pde", tags: ["3D"] },
{ path: "hue.pde", tags: ["2D"] },
{ path: "saturation.pde", tags: ["2D"] },
{ path: "brightness.pde", tags: ["2D"] },
@@ -27,14 +30,20 @@ var tests = [
{ path: "zoom.pde", tags: ["3D"], epsilonOverride: 0.07 },
{ path: "tint-isImageDirty.pde", tags: ["2D"] },
{ path: "copy-no-source.pde", tags: ["2D", "BLEND"] },
+ { path: "pgraphics.pde", tags: ["2D"], epsilonOverride: 0.08 },
{ path: "pgraphics-get-3d.pde", tags: ["3D"] },
{ path: "rounding.pde", tags: ["2D", "Crisp"] },
{ path: "pimage-get.pde", tags: ["2D", "Color Profile"] },
{ path: "pimage-get0.pde", tags: ["2D", "Color Profile"] },
+ { path: "pimage-get-and-place.pde", tags: ["2D", "Color Profile"] },
{ path: "pimage-fromImageData.pde", tags: ["2D"] },
{ path: "pimage-mask.pde", tags: ["2D"] },
{ path: "pimage-pgraphics-mask.pde", tags: ["2D"] },
{ path: "pimage-array-mask.pde", tags: ["2D"] },
+ { path: "pimage-resize-smaller.pde", tags: ["2D"] },
+ { path: "pimage-resize-bigger.pde", tags: ["2D"] },
+ { path: "pimage-resize-x.pde", tags: ["2D"] },
+ { path: "pimage-resize-y.pde", tags: ["2D"], epsilonOverride: 0.08 },
{ path: "smooth.pde", tags: ["2D"], epsilonOverride: 0.18 },
{ path: "crispy.pde", tags: ["2D", "Crisp"] },
{ path: "crisp-point.pde", tags: ["2D", "Crisp"] },
@@ -66,7 +75,7 @@ var tests = [
{ path: "bouncy-bubbles.pde", tags: ["2D", "Test Suite"] },
{ path: "brownian.pde", tags: ["2D", "Test Suite"], epsilonOverride: 0.07 },
{ path: "circle-collision.pde", tags: ["2D", "Test Suite"] },
- { path: "color-wheel.pde", tags: ["2D", "Test Suite"], knownFailureTicket: "1700" },
+ { path: "color-wheel.pde", tags: ["2D", "Test Suite"] },
{ path: "composite-objects.pde", tags: ["2D", "Test Suite"] },
{ path: "conway.pde", tags: ["2D", "Test Suite"] },
{ path: "double-random.pde", tags: ["2D", "Test Suite"] },
@@ -99,8 +108,12 @@ var tests = [
{ path: "sine.pde", tags: ["2D", "Test Suite"] },
{ path: "spore1.pde", tags: ["2D", "Test Suite"] },
{ path: "translate.pde", tags: ["2D", "Test Suite"] },
- { path: "vertices.pde", tags: ["2D", "Test Suite"], knownFailureTicket: "1700" },
+ { path: "vertices.pde", tags: ["2D", "Test Suite"] },
{ path: "wolfram.pde", tags: ["2D", "Test Suite"] },
+ { path: "pshape_ellipseMode.pde", tags: ["2D","SVG"] },
+ { path: "pshape_svg.pde", tags: ["2D","SVG"], epsilonOverride: 0.07 },
+ { path: "shearx.pde", tags: ["2D"] },
+ { path: "sheary.pde", tags: ["2D"] },
{ path: "loadShape.pde", tags: ["2D","SVG"], epsilonOverride: 0.06 },
{ path: "loadShape2.pde", tags: ["2D","SVG"], epsilonOverride: 0.08 },
{ path: "loadShape3.pde", tags: ["2D","SVG"], epsilonOverride: 0.07 },
@@ -118,11 +131,12 @@ var tests = [
{ path: "loadShape16.pde", tags: ["2D","SVG"], epsilonOverride: 0.06 },
{ path: "loadShape17.pde", tags: ["2D","SVG"], epsilonOverride: 0.06 },
{ path: "loadShape18.pde", tags: ["2D","SVG"], epsilonOverride: 0.17 },
+ { path: "svg-buffered.pde", tags: ["2D","SVG"] },
{ path: "blur.pde", tags: ["2D","Convolution"] },
{ path: "edgedetect.pde", tags: ["2D","Convolution"] },
- { path: "size-3D.pde", tags: ["3D"] },
+ { path: "size-3d.pde", tags: ["3D"] },
{ path: "empty-draw-2D.pde", tags: ["2D"] },
- { path: "empty-draw-3D.pde", tags: ["3D"], knownFailureTicket: "1651" },
+ { path: "empty-draw-3D.pde", tags: ["3D"] },
{ path: "defaults-background_and_size.pde", tags: ["2D"] },
{ path: "background-gray.pde", tags: ["2D"] },
{ path: "background-gray-alpha.pde", tags: ["2D"] },
@@ -240,8 +254,8 @@ var tests = [
{ path: "bezier-ellipse.pde", tags: ["2D", "Crisp"], epsilonOverride: 0.06 },
{ path: "curves.pde", tags: ["2D"], epsilonOverride: 0.07 },
{ path: "curve.pde", tags: ["2D"], epsilonOverride: 0.09 },
- { path: "curve-3D.pde", tags: ["3D"], epsilonOverride: 0.11, knownFailureTicket: "1700" },
- { path: "curveDetail.pde", tags: ["3D"], knownFailureTicket: "1416" },
+ { path: "curve-3D.pde", tags: ["3D"], epsilonOverride: 0.11 },
+ { path: "curveDetail.pde", tags: ["3D"] },
{ path: "curvePoint.pde", tags: ["2D"], epsilonOverride: 0.11 },
{ path: "curveTangent.pde", tags: ["2D"], epsilonOverride: 0.10 },
{ path: "curveTightness.pde", tags: ["2D"], epsilonOverride: 0.11 },
@@ -252,7 +266,7 @@ var tests = [
{ path: "rect-quad.pde", tags: ["2D"] },
{ path: "size-fill-rect.pde", tags: ["2D"] },
{ path: "triangle.pde", tags: ["2D"] },
- { path: "3d-arc-4-combo.pde", tags: ["3D"], epsilonOverride: 0.13, knownFailureTicket: "1700" },
+ { path: "3d-arc-4-combo.pde", tags: ["3D"], epsilonOverride: 0.13},
{ path: "line-3d.pde", tags: ["3D"], epsilonOverride: 0.08 },
{ path: "default_perspective.pde", tags: ["3D"], epsilonOverride: 0.11 },
{ path: "default_perspective_2.pde", tags: ["3D"], epsilonOverride: 0.11 },
@@ -260,10 +274,17 @@ var tests = [
{ path: "3D_beginendcam.pde", tags: ["3D"], epsilonOverride: 0.09 },
{ path: "3D_perspective.pde", tags: ["3D"], epsilonOverride: 0.11 },
{ path: "3D_ortho.pde", tags: ["3D"], knownFailureTicket: "1200" },
+
+ // 3D Points
{ path: "point_3D_stroke.pde", tags: ["3D"] },
{ path: "point_3D_strokeWeight.pde", tags: ["3D"], epsilonOverride: 0.22 },
{ path: "point_3D_z.pde", tags: ["3D"], epsilonOverride: 0.14 },
{ path: "point_3D_noz.pde", tags: ["3D"], epsilonOverride: 0.14 },
+ { path: "point_3D_smooth.pde", tags: ["3D"], epsilonOverride: 0.14 },
+ { path: "point_3D_smooth_beginShape.pde", tags: ["3D"], epsilonOverride: 0.14 },
+ { path: "point_3D_smooth_stroke.pde", tags: ["3D"], epsilonOverride: 0.14 },
+ { path: "point_3D_smooth_hint_off.pde", tags: ["3D"], epsilonOverride: 0.14 },
+
{ path: "box.pde", tags: ["3D"], epsilonOverride: 0.18 },
{ path: "box_scale_3D.pde", tags: ["3D"], epsilonOverride: 0.18 },
{ path: "applyMatrix.pde", tags: ["3D"] },
@@ -284,7 +305,7 @@ var tests = [
{ path: "shininess_p5test.pde", tags: ["3D"] },
{ path: "specular_p5test.pde", tags: ["3D"]},
{ path: "spotLight_p5test.pde", tags: ["3D"], knownFailureTicket: "1239" }, /* See ticket #1202 */
- { path: "3d-ellipse-fill-noFill-stoke-noStroke.pde", tags: ["3D"], epsilonOverride: 0.15, knownFailureTicket: "1700" },
+ { path: "3d-ellipse-fill-noFill-stoke-noStroke.pde", tags: ["3D"], epsilonOverride: 0.15 },
{ path: "createGraphics.pde", tags: ["3D"], epsilonOverride: 0.07 }, /* See ticket #1075 */
{ path: "rect-directional-light.pde", tags: ["3D"] },
{ path: "hint_depth.pde", tags: ["3D"], epsilonOverride: 0.11 },
4 test/ref/tint-isImageDirty.pde 100644 → 100755
View
2 additions, 2 deletions not shown
1  test/ref/translate.pde
View
@@ -6,6 +6,7 @@ float s = 40.0;
void setup()
{
size(100,100);
+ frameRate(1000);
noStroke();
}
15 test/unit/XMLElement/P52.0/XMLAddChild.pde
View
@@ -0,0 +1,15 @@
+String sites = "<?xml version='1.0'?>\n"+
+ "<websites>\n"+
+ " <site id='0' url='processing.org'>Processing</site>\n"+
+ " <site id='1' url='mobile.processing.org'>Processing Mobile</site>\n"+
+ "</websites>";
+String site = "<site id='3' url='processingjs.org'>Processing JavaScript</site>\n";
+
+XML xml = XML.parse(sites);
+XML child = XML.parse(site);
+int numSites = xml.getChildCount();
+_checkEqual(numSites,2);
+
+xml.addChild(child);
+numSites = xml.getChildCount();
+_checkEqual(numSites,3);
17 test/unit/XMLElement/P52.0/XMLAttribute/XMLAttributeGet.pde
View
@@ -0,0 +1,17 @@
+String sites = "<?xml version='1.0'?>\n"+
+ "<websites number='2'>\n"+
+ " <site id='0' url='processing.org'>Processing</site>\n"+
+ " <site id='1' url='mobile.processing.org'>Processing Mobile</site>\n"+
+ "</websites>";
+
+// load XML data
+XML xml = XML.parse(sites);
+
+String strVal = xml.getString("number");
+_checkEqual(strVal,"2");
+
+int intVal = xml.getInt("number");
+_checkEqual(intVal,2);
+
+float floatVal = xml.getFloat("number");
+_checkEqual(floatVal,2.0);
10 test/unit/XMLElement/P52.0/XMLAttribute/XMLAttributeRemove.pde
View
@@ -0,0 +1,10 @@
+String sites = "<?xml version='1.0'?>\n"+
+ "<websites number='2'>\n"+
+ " <site id='0' url='processing.org'>Processing</site>\n"+
+ " <site id='1' url='mobile.processing.org'>Processing Mobile</site>\n"+
+ "</websites>";
+
+XML xml = XML.parse(sites);
+xml.removeAttribute("number");
+String number = xml.getAttribute("number");
+_checkIsNull(number);
19 test/unit/XMLElement/P52.0/XMLAttribute/XMLAttributeSet.pde
View
@@ -0,0 +1,19 @@
+String sites = "<?xml version='1.0'?>\n"+
+ "<websites>\n"+
+ " <site id='0' url='processing.org'>Processing</site>\n"+
+ " <site id='1' url='mobile.processing.org'>Processing Mobile</site>\n"+
+ "</websites>";
+
+XML xml = XML.parse(sites);
+
+xml.setString("number_s", "5");
+String number_s = xml.getString("number_s");
+_checkEqual(number_s,"5");
+
+xml.setInt("number_i", 5);
+int number_i = xml.getInt("number_i");
+_checkEqual(number_i, 5);
+
+xml.setFloat("number_f", 5.5);
+float number_f = xml.getFloat("number_f");
+_checkEqual(number_f, 5.5);
24 test/unit/XMLElement/P52.0/XMLEquals.pde
View
@@ -0,0 +1,24 @@
+String xmlstring1 = "<xml test='monkey'>lalalas<b>moobles</b>ginger beer</xml>";
+String xmlstring2 = "<xml test='monkey'>lalalas<b>moobles</b>ginger beeeer</xml>";
+
+// test for different XML
+XML xml1 = XML.parse(xmlstring1);
+XML xml2 = XML.parse(xmlstring2);
+_checkEqual(xml1.toString().equals(xml2.toString()), false);
+_checkEqual(xml1.equals(xml2), false);
+
+// test for equal XML
+xml2 = XML.parse(xmlstring1);
+_checkEqual(xml1.toString().equals(xml2.toString()), true);
+_checkEqual(xml1.equals(xml2), true);
+
+// test for self-copy construction
+xml2 = XML.parse(xml1.toString());
+_checkEqual(xml1.equals(xml2), true);
+
+// test for functionally equal XML, with differently ordered attributes
+xmlstring1 = "<xml a='a' e='e'>lalalas<b c='c' d='d'>moobles</b></xml>";
+xmlstring2 = "<xml e='e' a='a'>lalalas<b d='d' c='c'>moobles</b></xml>";
+XML xml1 = XML.parse(xmlstring1);
+XML xml2 = XML.parse(xmlstring2);
+_checkEqual(xml1.equals(xml2), true);
20 test/unit/XMLElement/P52.0/XMLGetChild.pde
View
@@ -0,0 +1,20 @@
+String xml = "<?xml version='1.0'?>\n"+
+ "<websites>\n"+
+ " <site id='0' url='processing.org'>Processing</site>\n"+
+ " <site id='1' url='mobile.processing.org'>Processing Mobile</site>\n"+
+ "</websites>";
+
+String[] urls = ["processing.org", "mobile.processing.org"];
+String[] sites = ["Processing", "Processing Mobile"];
+
+XML root = XML.parse(xml);
+int numSites = root.getChildCount();
+for (int i = 0; i < numSites; i++) {
+ XML child = root.getChild(i);
+ int id = child.getIntAttribute("id");
+ _checkEqual(i, id);
+ String url = child.getStringAttribute("url");
+ _checkEqual(url, urls[i]);
+ String site = child.getContent();
+ _checkEqual(site, sites[i]);
+}
21 test/unit/XMLElement/P52.0/XMLGetChildNS.pde
View
@@ -0,0 +1,21 @@
+String xml = '<?xml version="1.0"?>' + "\n"+
+ '<location xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">'+"\n"+
+ ' <geo:Point>'+"\n"+
+ ' <geo:lat>40</geo:lat>'+"\n"+
+ ' <geo:lon>-90</geo:lon>'+"\n"+
+ ' </geo:Point>'+"\n"+
+ '</location>';
+
+XML root = XML.parse(xml);
+
+String ref1 = '<geo:Point>'+
+ '<geo:lat>40</geo:lat>'+
+ '<geo:lon>-90</geo:lon>'+
+ '</geo:Point>';
+
+_checkEqual(root.getChild("geo:Point"), ref1),
+_checkIsNull(root.getChild("Point"));
+
+String ref2 = '<geo:lat>40</geo:lat>';
+_checkEqual(root.getChild("geo:Point/geo:lat"), ref2);
+_checkIsNull(root.getChild("Point/lat"));
22 test/unit/XMLElement/P52.0/XMLInsertChild.pde
View
@@ -0,0 +1,22 @@
+String sites = "<?xml version='1.0'?>\n"+
+ "<websites>\n"+
+ " <site id='0' url='processing.org'>Processing</site>\n"+
+ " <site id='1' url='mobile.processing.org'>Processing Mobile</site>\n"+
+ "</websites>";
+String site = "<site id='3' url='processingjs.org'>Processing JavaScript</site>\n";
+
+XML xml = XML.parse(sites);
+XML child = XML.parse(site);
+
+// verify correct number of children
+int numSites = xml.getChildCount();
+_checkEqual(numSites, 2);
+
+// verify correct number of children after insert
+xml.insertChild(child,1);
+numSites = xml.getChildCount();
+_checkEqual(numSites, 3);
+
+// verify correct insertion
+XML child1 = xml.getChild(1);
+_checkEqual(child, child1);
29 test/unit/XMLElement/P52.0/XMLRemoveChild.pde
View
@@ -0,0 +1,29 @@
+String sites = "<?xml version='1.0'?>\n"+
+ "<websites>\n"+
+ " <site id='0' url='processing.org'>Processing</site>\n"+
+ " <site id='1' url='mobile.processing.org'>Processing Mobile</site>\n"+
+ "</websites>";
+
+String site1 = "<site id='0' url='processing.org'>Processing</site>";
+String site2 = "<site id='1' url='mobile.processing.org'>Processing Mobile</site>";
+String site3 = "<site id='2' url='processingjs.org'>Processing JS</site>";
+
+XML xml = XML.parse(sites);
+XML child1 = XML.parse(site1);
+XML child2 = XML.parse(site2);
+XML child3 = XML.parse(site3);
+
+int numSites = xml.getChildCount();
+_checkEqual(numSites,2);
+
+xml.removeChild(child3);
+numSites = xml.getChildCount();
+_checkEqual(numSites,2);
+
+xml.removeChild(child2);
+numSites = xml.getChildCount();
+_checkEqual(numSites,1);
+
+xml.removeChild(child1);
+numSites = xml.getChildCount();
+_checkEqual(numSites,0);
17 test/unit/XMLElement/P52.0/XMLRemoveChildAtIndex.pde
View
@@ -0,0 +1,17 @@
+String sites1 = "<?xml version='1.0'?>\n"+
+ "<websites>\n"+
+ " <site id='0' url='processing.org'>Processing</site>\n"+
+ " <site id='1' url='mobile.processing.org'>Processing Mobile</site>\n"+
+ "</websites>";
+
+String sites2 = "<?xml version='1.0'?>\n"+
+ "<websites>\n"+
+ " <site id='0' url='processing.org'>Processing</site>\n"+
+ "</websites>";
+
+XML xml1 = XML.parse(sites1);
+XML xml2 = XML.parse(sites2);
+
+xml1.removeChildAtIndex(1);
+_checkTrue(xml1.equals(xml2));
+_checkTrue(xml2.equals(xml1));
21 test/unit/XMLElement/P52.0/XMLgetChildCount.pde
View
@@ -0,0 +1,21 @@
+String sites = "";
+
+sites = "<?xml version='1.0'?>\n"+
+ "<a></a>";
+
+XML xml = XML.parse(sites);
+int numSites = xml.getChildCount();
+_checkEqual(numSites,0);
+
+
+sites = "<?xml version='1.0'?>\n"+
+ "<a>\n"+
+ " <b>\n"+
+ " <c>text c</c>\n"+
+ " </b>\n"+
+ " <b>text b</b>\n"+
+ "</a>";
+
+XML xml = new XML(sites);
+int numSites = xml.getChildCount();
+_checkEqual(numSites,2);
10 test/unit/XMLElement/P52.0/XMLgetContent.pde
View
@@ -0,0 +1,10 @@
+String sites = "<?xml version='1.0'?>\n"+
+ "<websites>\n"+
+ " <site id='0' url='processing.org'>Processing</site>\n"+
+ " <site id='1' url='mobile.processing.org'>Processing Mobile</site>\n"+
+ "</websites>";
+
+XML xml = XML.parse(sites);
+XML child = xml.getChild(0);
+String site = child.getContent();
+_checkEqual(site, "Processing");
2  test/unit/XMLElement/XMLAttribute/XMLAttributeGet.pde
View
@@ -4,6 +4,6 @@ String sites = "<?xml version='1.0'?>\n"+
" <site id='1' url='mobile.processing.org'>Processing Mobile</site>\n"+
"</websites>";
-XMLElement xml = new XMLElement(sites);
+XMLElement xml = XMLElement.parse(sites);
String number = xml.getAttribute("number");
_checkEqual(number,"2");
2  test/unit/XMLElement/XMLAttribute/XMLAttributeRemove.pde
View
@@ -4,7 +4,7 @@ String sites = "<?xml version='1.0'?>\n"+
" <site id='1' url='mobile.processing.org'>Processing Mobile</site>\n"+
"</websites>";
-XMLElement xml = new XMLElement(sites);
+XMLElement xml = XMLElement.parse(sites);
xml.removeAttribute("number");
String number = xml.getAttribute("number");
_checkIsNull(number);
21 test/unit/XMLElement/XMLElementGetChildNS.pde
View
@@ -0,0 +1,21 @@
+String xml = '<?xml version="1.0"?>' + "\n"+
+ '<location xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">'+"\n"+
+ ' <geo:Point>'+"\n"+
+ ' <geo:lat>40</geo:lat>'+"\n"+
+ ' <geo:lon>-90</geo:lon>'+"\n"+
+ ' </geo:Point>'+"\n"+
+ '</location>';
+
+XMLElement root = XMLElement.parse(xml);
+
+String ref1 = '<geo:Point>'+
+ '<geo:lat>40</geo:lat>'+
+ '<geo:lon>-90</geo:lon>'+
+ '</geo:Point>';
+
+_checkEqual(root.getChild("geo:Point"), ref1),
+_checkIsNull(root.getChild("Point"));
+
+String ref2 = '<geo:lat>40</geo:lat>';
+_checkEqual(root.getChild("geo:Point/geo:lat"), ref2);
+_checkIsNull(root.getChild("Point/lat"));
8 test/unit/XMLElement/XMLElementWithCDATA.pde
View
@@ -0,0 +1,8 @@
+String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+
+ "<content>"+
+ " <title><![CDATA[The \"<Battle lol='cat'>\" of t' Brooklyn]]></title>"+
+ "</content>";
+XMLElement root = XMLElement.parse(xml);
+
+_checkEqual(root.getChild(0).toString(), "<title>The &quot;&lt;Battle lol=&apos;cat&apos;&gt;&quot; of t&apos; Brooklyn</title>");
+_checkEqual(root.getChild(0).getContent(), "The \"<Battle lol='cat'>\" of t' Brooklyn");
4 test/unit/arrayCopy.pde
View
@@ -29,8 +29,8 @@ _checkEqual(combined[0][0], "ON");
_checkEqual(combined[0][1], "QC");
_checkEqual(combined[1][0], "FL");
_checkEqual(combined[1][1], "NY");
-_checkEqual(combined[2][0], 0);
-_checkEqual(combined[2][1], 0);
+_checkIsNull(combined[2][0]);
+_checkIsNull(combined[2][1]);
arrayCopy(codes2, 0, combined, 2, 2); //combined is now ON,QC,PE,NB,FL,NY,TX,CA,NS,MN,BC,NF,IL,NJ,WY,OH
_checkEqual(combined[2][0], "NS");
_checkEqual(combined[2][1], "MN");
3  test/unit/arrayList.pde
View
@@ -21,3 +21,6 @@ list1Clone.remove(0);
ArrayList list2 = new ArrayList(list1);
_checkEqual(list1, list2);
+
+ArrayList list3 = new ArrayList(5);
+_checkEqual(list3.size(), 5);
27 test/unit/arrayListIndexing.pde
View
@@ -0,0 +1,27 @@
+ArrayList list = new ArrayList();
+list.add("George");
+list.add("Jim");
+list.add("John");
+list.add("Blake");
+list.add("Kevin");
+list.add("George");
+list.add("Jim");
+list.add("John");
+list.add("Blake");
+list.add("Kevin");
+list.add("George");
+list.add("Jim");
+list.add("John");
+list.add("Blake");
+list.add("Kevin");
+list.add("George");
+list.add("Jim");
+list.add("John");
+list.add("Blake");
+list.add("Kevin");
+
+int firstKevin = list.indexOf("Kevin");
+_checkEqual(firstKevin, 4);
+
+int lastKevin = list.lastIndexOf("Kevin");
+_checkEqual(lastKevin, 19);
19 test/unit/arrayListRemoveAll.pde
View
@@ -0,0 +1,19 @@
+one = new ArrayList();
+one.add(1);
+one.add(2);
+one.add(3);
+one.add(4);
+one.add(5);
+
+two = new ArrayList();
+two.add(1412);
+two.add("hello");
+two.add(5);
+two.add(1);
+two.add(13);
+
+//removes the elements from one which exist in two
+one.removeAll(two);
+_checkEqual(one.get(0), 2);
+_checkEqual(one.get(1), 3);
+_checkEqual(one.get(2), 4);
15 test/unit/dollarSignCtor.pde
View
@@ -0,0 +1,15 @@
+class Dollar$ign {
+ public int first = 0;
+ public int second = 0;
+ public Dollar$ign(int first, int second) {
+ this.first = first;
+ this.second = second;
+ }
+}
+
+void setupTest() {
+ Dollar$ign d = new Dollar$ign(200, 300);
+ _checkEqual(200, d.first);
+ _checkEqual(300, d.second);
+}
+setupTest();
27 test/unit/generics.pde
View
@@ -61,3 +61,30 @@ if(j<<q>0) { i = 22; } _checkEqual(i, 22);
// if(0<j>>q) { i = 33; } _checkEqual(i, 33);
// void func1(boolean a, boolean b) {} func1(0<j,q> 0);
+
+// test array notation
+String[] strarr = {"a","b","c"};
+HashMap<String, String[]> hms1 = new HashMap<String, String[]>();
+hms1.put("a",strarr);
+_checkEqual(hms1.get("a"), strarr);
+
+HashMap<String[], String> hms2 = new HashMap<String[], String>();
+hms2.put(strarr,"a");
+_checkEqual(hms2.get(strarr),"a");
+
+HashMap<String[], String[]> hms3 = new HashMap<String[], String[]>();
+hms3.put(strarr,strarr);
+_checkEqual(hms3.get(strarr),strarr);
+
+String[][] strarr2 = {{"a","b","c"}};
+HashMap<String, String[][]> hms4 = new HashMap<String, String[][]>();
+hms4.put("a",strarr2);
+_checkEqual(hms4.get("a"), strarr2);
+
+HashMap<String[][], String> hms5 = new HashMap<String[][], String>();
+hms5.put(strarr2,"a");
+_checkEqual(hms5.get(strarr2),"a");
+
+HashMap<String[][], String[][]> hms6 = new HashMap<String[][], String[][]>();
+hms5.put(strarr2,strarr2);
+_checkEqual(hms5.get(strarr2),strarr2);
17 test/unit/hashMapIteratorRemove.pde
View
@@ -0,0 +1,17 @@
+HashMap<String,String> map = new HashMap<String,String>();
+
+map.put("a","1");