mirror of
https://github.com/processing/processing4.git
synced 2026-04-20 19:24:26 +02:00
Added tests for smooth and noSmooth for preproc.
In response to https://github.com/processing/processing4/issues/149, adding tests to catch issues with smooth and noSmooth in the preprocessor. Issue found by @benfry.
This commit is contained in:
@@ -365,4 +365,19 @@ public class ParserTests {
|
||||
expectGood("colorreturn");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoSmooth() {
|
||||
expectGood("nosmooth");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSmooth() {
|
||||
expectGood("smoothnoparam");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSmoothWithParam() {
|
||||
expectGood("smoothparam");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
48
java/test/resources/nosmooth.expected
Normal file
48
java/test/resources/nosmooth.expected
Normal file
@@ -0,0 +1,48 @@
|
||||
import processing.core.*;
|
||||
import processing.data.*;
|
||||
import processing.event.*;
|
||||
import processing.opengl.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.io.File;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class nosmooth extends PApplet {
|
||||
|
||||
public void setup() {
|
||||
/* size commented out by preprocessor */;
|
||||
/* noSmooth commented out by preprocessor */;
|
||||
}
|
||||
|
||||
@Override public void draw() {
|
||||
background(0);
|
||||
fill(255,0,0);
|
||||
ellipse(100,100,100,100);
|
||||
fill(0,255,0);
|
||||
ellipse(150,150,100,100);
|
||||
}
|
||||
|
||||
class Test {
|
||||
private void draw() {}
|
||||
}
|
||||
|
||||
|
||||
public void settings() {
|
||||
size(300,300, P2D);
|
||||
noSmooth();
|
||||
}
|
||||
|
||||
static public void main(String[] passedArgs) {
|
||||
String[] appletArgs = new String[] { "nosmooth" };
|
||||
if (passedArgs != null) {
|
||||
PApplet.main(concat(appletArgs, passedArgs));
|
||||
} else {
|
||||
PApplet.main(appletArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
12
java/test/resources/nosmooth.pde
Normal file
12
java/test/resources/nosmooth.pde
Normal file
@@ -0,0 +1,12 @@
|
||||
void setup(){
|
||||
size(300,300, P2D);
|
||||
noSmooth();
|
||||
}
|
||||
|
||||
void draw(){
|
||||
background(0);
|
||||
fill(255,0,0);
|
||||
ellipse(100,100,100,100);
|
||||
fill(0,255,0);
|
||||
ellipse(150,150,100,100);
|
||||
}
|
||||
48
java/test/resources/smoothnoparam.expected
Normal file
48
java/test/resources/smoothnoparam.expected
Normal file
@@ -0,0 +1,48 @@
|
||||
import processing.core.*;
|
||||
import processing.data.*;
|
||||
import processing.event.*;
|
||||
import processing.opengl.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.io.File;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class smoothnoparam extends PApplet {
|
||||
|
||||
public void setup() {
|
||||
/* size commented out by preprocessor */;
|
||||
/* smooth commented out by preprocessor */;
|
||||
}
|
||||
|
||||
@Override public void draw() {
|
||||
background(0);
|
||||
fill(255,0,0);
|
||||
ellipse(100,100,100,100);
|
||||
fill(0,255,0);
|
||||
ellipse(150,150,100,100);
|
||||
}
|
||||
|
||||
class Test {
|
||||
private void draw() {}
|
||||
}
|
||||
|
||||
|
||||
public void settings() {
|
||||
size(300,300, P2D);
|
||||
smooth();
|
||||
}
|
||||
|
||||
static public void main(String[] passedArgs) {
|
||||
String[] appletArgs = new String[] { "smoothnoparam" };
|
||||
if (passedArgs != null) {
|
||||
PApplet.main(concat(appletArgs, passedArgs));
|
||||
} else {
|
||||
PApplet.main(appletArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
12
java/test/resources/smoothnoparam.pde
Normal file
12
java/test/resources/smoothnoparam.pde
Normal file
@@ -0,0 +1,12 @@
|
||||
void setup(){
|
||||
size(300,300, P2D);
|
||||
smooth();
|
||||
}
|
||||
|
||||
void draw(){
|
||||
background(0);
|
||||
fill(255,0,0);
|
||||
ellipse(100,100,100,100);
|
||||
fill(0,255,0);
|
||||
ellipse(150,150,100,100);
|
||||
}
|
||||
48
java/test/resources/smoothparam.expected
Normal file
48
java/test/resources/smoothparam.expected
Normal file
@@ -0,0 +1,48 @@
|
||||
import processing.core.*;
|
||||
import processing.data.*;
|
||||
import processing.event.*;
|
||||
import processing.opengl.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.io.File;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class smoothparam extends PApplet {
|
||||
|
||||
public void setup() {
|
||||
/* size commented out by preprocessor */;
|
||||
/* smooth commented out by preprocessor */;
|
||||
}
|
||||
|
||||
@Override public void draw() {
|
||||
background(0);
|
||||
fill(255,0,0);
|
||||
ellipse(100,100,100,100);
|
||||
fill(0,255,0);
|
||||
ellipse(150,150,100,100);
|
||||
}
|
||||
|
||||
class Test {
|
||||
private void draw() {}
|
||||
}
|
||||
|
||||
|
||||
public void settings() {
|
||||
size(300,300, P2D);
|
||||
smooth(4);
|
||||
}
|
||||
|
||||
static public void main(String[] passedArgs) {
|
||||
String[] appletArgs = new String[] { "smoothparam" };
|
||||
if (passedArgs != null) {
|
||||
PApplet.main(concat(appletArgs, passedArgs));
|
||||
} else {
|
||||
PApplet.main(appletArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
12
java/test/resources/smoothparam.pde
Normal file
12
java/test/resources/smoothparam.pde
Normal file
@@ -0,0 +1,12 @@
|
||||
void setup(){
|
||||
size(300,300, P2D);
|
||||
smooth(4);
|
||||
}
|
||||
|
||||
void draw(){
|
||||
background(0);
|
||||
fill(255,0,0);
|
||||
ellipse(100,100,100,100);
|
||||
fill(0,255,0);
|
||||
ellipse(150,150,100,100);
|
||||
}
|
||||
Reference in New Issue
Block a user