mirror of
https://github.com/processing/processing4.git
synced 2026-01-27 02:11:08 +01:00
Closes #317: Preproc behavior when size defined in user class.
Though this was already fixed, just adding a test to confirm that it stays fixed. Need to respect calls to user-definined size methods including those defined in user-made classes.
This commit is contained in:
@@ -410,4 +410,9 @@ public class ParserTests {
|
||||
expectRunnerException("mixing", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSizeClass() {
|
||||
expectGood("sizeclass");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
50
java/test/resources/sizeclass.expected
Normal file
50
java/test/resources/sizeclass.expected
Normal file
@@ -0,0 +1,50 @@
|
||||
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 sizeclass extends PApplet {
|
||||
|
||||
// Thanks StanLepunK: https://github.com/processing/processing4/issues/317
|
||||
Truc truc = new Truc();
|
||||
|
||||
public void setup() {
|
||||
/* size commented out by preprocessor */;
|
||||
truc.size(1,1); // problem >>> error \u00e0 "."
|
||||
// func();
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
truc.size(1,1); // no problem
|
||||
}
|
||||
|
||||
public void func() {
|
||||
truc.size(1,1); // no problem
|
||||
}
|
||||
|
||||
class Truc {
|
||||
public void size(int x, int y) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void settings() { size(200, 200); }
|
||||
|
||||
static public void main(String[] passedArgs) {
|
||||
String[] appletArgs = new String[] { "sizeclass" };
|
||||
if (passedArgs != null) {
|
||||
PApplet.main(concat(appletArgs, passedArgs));
|
||||
} else {
|
||||
PApplet.main(appletArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
21
java/test/resources/sizeclass.pde
Normal file
21
java/test/resources/sizeclass.pde
Normal file
@@ -0,0 +1,21 @@
|
||||
// Thanks StanLepunK: https://github.com/processing/processing4/issues/317
|
||||
Truc truc = new Truc();
|
||||
|
||||
void setup() {
|
||||
size(200,200);
|
||||
truc.size(1,1); // problem >>> error à "."
|
||||
// func();
|
||||
}
|
||||
|
||||
void draw() {
|
||||
truc.size(1,1); // no problem
|
||||
}
|
||||
|
||||
void func() {
|
||||
truc.size(1,1); // no problem
|
||||
}
|
||||
|
||||
class Truc {
|
||||
void size(int x, int y) {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user