Permalink
Browse files

add regression test for loadPixels()

  • Loading branch information...
1 parent e4c55cd commit 8bbc09f0f7aab0b225cf872c5a8380b72d4f8d21 @jdf committed Oct 17, 2010
Showing with 16 additions and 11 deletions.
  1. +16 −11 testing/tests/test/jycessing/JycessingTests.java
View
27 testing/tests/test/jycessing/JycessingTests.java
@@ -2,13 +2,13 @@
import static junit.framework.Assert.assertEquals;
-import org.junit.Test;
-import org.junit.runner.JUnitCore;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
import jycessing.Runner;
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
+import org.junit.Test;
+import org.junit.runner.JUnitCore;
public class JycessingTests {
@@ -18,10 +18,10 @@ private static String run(final String testResource) throws Exception {
try {
System.setOut(new PrintStream(baos, true));
Runner.main(new String[] { "testing/test_resources/test_"
- + testResource + ".py" });
+ + testResource + ".py" });
Thread.sleep(500);
return new String(baos.toByteArray()).replaceAll("\r\n", "\n")
- .replaceAll("\r", "\n");
+ .replaceAll("\r", "\n");
} finally {
System.setOut(saved);
}
@@ -36,10 +36,10 @@ private static void testImport(final String module) throws Exception {
final String bogusFileName = "<test " + module + ">";
final String testText = "import " + module + "\nprint 'OK'";
Runner.runSketch(new String[] { testClass }, bogusFileName,
- testText);
+ testText);
assertEquals("OK\n",
- new String(baos.toByteArray()).replaceAll("\r\n", "\n")
- .replaceAll("\r", "\n"));
+ new String(baos.toByteArray()).replaceAll("\r\n", "\n")
+ .replaceAll("\r", "\n"));
} finally {
System.setOut(saved);
}
@@ -58,7 +58,7 @@ public void static_size() throws Exception {
@Test
public void set_builtins() throws Exception {
assertEquals("128\nset(['banana'])\nissubclass: True\nset(['baz'])\n",
- run("set"));
+ run("set"));
}
@Test
@@ -99,14 +99,19 @@ public void calendar() throws Exception {
@Test
public void processing_core() throws Exception {
assertEquals("[ 1.0, 2.0, 3.0 ]\n<type 'processing.core.PFont'>\n",
- run("pcore"));
+ run("pcore"));
}
@Test
public void pvector() throws Exception {
assertEquals("OK\n", run("pvector"));
}
+ @Test
+ public void loadPixels() throws Exception {
+ assertEquals("OK\n", run("loadPixels"));
+ }
+
public static void main(final String[] args) {
JUnitCore.runClasses(JycessingTests.class);
}

0 comments on commit 8bbc09f

Please sign in to comment.