Skip to content

Commit 3e7aab9

Browse files
committed
Added tests for smooth and noSmooth for preproc.
In response to #149, adding tests to catch issues with smooth and noSmooth in the preprocessor. Issue found by @benfry.
1 parent e96622d commit 3e7aab9

File tree

7 files changed

+195
-0
lines changed

7 files changed

+195
-0
lines changed

java/test/processing/mode/java/ParserTests.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,4 +365,19 @@ public void testColorReturn() {
365365
expectGood("colorreturn");
366366
}
367367

368+
@Test
369+
public void testNoSmooth() {
370+
expectGood("nosmooth");
371+
}
372+
373+
@Test
374+
public void testSmooth() {
375+
expectGood("smoothnoparam");
376+
}
377+
378+
@Test
379+
public void testSmoothWithParam() {
380+
expectGood("smoothparam");
381+
}
382+
368383
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import processing.core.*;
2+
import processing.data.*;
3+
import processing.event.*;
4+
import processing.opengl.*;
5+
6+
import java.util.HashMap;
7+
import java.util.ArrayList;
8+
import java.io.File;
9+
import java.io.BufferedReader;
10+
import java.io.PrintWriter;
11+
import java.io.InputStream;
12+
import java.io.OutputStream;
13+
import java.io.IOException;
14+
15+
public class nosmooth extends PApplet {
16+
17+
public void setup() {
18+
/* size commented out by preprocessor */;
19+
/* noSmooth commented out by preprocessor */;
20+
}
21+
22+
@Override public void draw() {
23+
background(0);
24+
fill(255,0,0);
25+
ellipse(100,100,100,100);
26+
fill(0,255,0);
27+
ellipse(150,150,100,100);
28+
}
29+
30+
class Test {
31+
private void draw() {}
32+
}
33+
34+
35+
public void settings() {
36+
size(300,300, P2D);
37+
noSmooth();
38+
}
39+
40+
static public void main(String[] passedArgs) {
41+
String[] appletArgs = new String[] { "nosmooth" };
42+
if (passedArgs != null) {
43+
PApplet.main(concat(appletArgs, passedArgs));
44+
} else {
45+
PApplet.main(appletArgs);
46+
}
47+
}
48+
}

java/test/resources/nosmooth.pde

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
void setup(){
2+
size(300,300, P2D);
3+
noSmooth();
4+
}
5+
6+
void draw(){
7+
background(0);
8+
fill(255,0,0);
9+
ellipse(100,100,100,100);
10+
fill(0,255,0);
11+
ellipse(150,150,100,100);
12+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import processing.core.*;
2+
import processing.data.*;
3+
import processing.event.*;
4+
import processing.opengl.*;
5+
6+
import java.util.HashMap;
7+
import java.util.ArrayList;
8+
import java.io.File;
9+
import java.io.BufferedReader;
10+
import java.io.PrintWriter;
11+
import java.io.InputStream;
12+
import java.io.OutputStream;
13+
import java.io.IOException;
14+
15+
public class smoothnoparam extends PApplet {
16+
17+
public void setup() {
18+
/* size commented out by preprocessor */;
19+
/* smooth commented out by preprocessor */;
20+
}
21+
22+
@Override public void draw() {
23+
background(0);
24+
fill(255,0,0);
25+
ellipse(100,100,100,100);
26+
fill(0,255,0);
27+
ellipse(150,150,100,100);
28+
}
29+
30+
class Test {
31+
private void draw() {}
32+
}
33+
34+
35+
public void settings() {
36+
size(300,300, P2D);
37+
smooth();
38+
}
39+
40+
static public void main(String[] passedArgs) {
41+
String[] appletArgs = new String[] { "smoothnoparam" };
42+
if (passedArgs != null) {
43+
PApplet.main(concat(appletArgs, passedArgs));
44+
} else {
45+
PApplet.main(appletArgs);
46+
}
47+
}
48+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
void setup(){
2+
size(300,300, P2D);
3+
smooth();
4+
}
5+
6+
void draw(){
7+
background(0);
8+
fill(255,0,0);
9+
ellipse(100,100,100,100);
10+
fill(0,255,0);
11+
ellipse(150,150,100,100);
12+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import processing.core.*;
2+
import processing.data.*;
3+
import processing.event.*;
4+
import processing.opengl.*;
5+
6+
import java.util.HashMap;
7+
import java.util.ArrayList;
8+
import java.io.File;
9+
import java.io.BufferedReader;
10+
import java.io.PrintWriter;
11+
import java.io.InputStream;
12+
import java.io.OutputStream;
13+
import java.io.IOException;
14+
15+
public class smoothparam extends PApplet {
16+
17+
public void setup() {
18+
/* size commented out by preprocessor */;
19+
/* smooth commented out by preprocessor */;
20+
}
21+
22+
@Override public void draw() {
23+
background(0);
24+
fill(255,0,0);
25+
ellipse(100,100,100,100);
26+
fill(0,255,0);
27+
ellipse(150,150,100,100);
28+
}
29+
30+
class Test {
31+
private void draw() {}
32+
}
33+
34+
35+
public void settings() {
36+
size(300,300, P2D);
37+
smooth(4);
38+
}
39+
40+
static public void main(String[] passedArgs) {
41+
String[] appletArgs = new String[] { "smoothparam" };
42+
if (passedArgs != null) {
43+
PApplet.main(concat(appletArgs, passedArgs));
44+
} else {
45+
PApplet.main(appletArgs);
46+
}
47+
}
48+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
void setup(){
2+
size(300,300, P2D);
3+
smooth(4);
4+
}
5+
6+
void draw(){
7+
background(0);
8+
fill(255,0,0);
9+
ellipse(100,100,100,100);
10+
fill(0,255,0);
11+
ellipse(150,150,100,100);
12+
}

0 commit comments

Comments
 (0)