mirror of
https://github.com/processing/processing4.git
synced 2026-01-27 18:31:07 +01:00
Add failing test for static mode class defintion.
This commit is contained in:
@@ -443,4 +443,9 @@ public class ParserTests {
|
||||
expectGood("fullscreen_export");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStaticClass() {
|
||||
expectGood("staticclass");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
47
java/test/resources/staticclass.expected
Normal file
47
java/test/resources/staticclass.expected
Normal file
@@ -0,0 +1,47 @@
|
||||
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 staticclass extends PApplet {
|
||||
public void setup() {
|
||||
class Button {
|
||||
|
||||
int x, y, radius;
|
||||
|
||||
public Button (int x, int y, int radius) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
public boolean over() {
|
||||
return dist(mouseX, mouseY, this.x, this.y) < this.radius;
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
ellipse(this.x, this.y, this.radius * 2, this.radius * 2);
|
||||
}
|
||||
|
||||
}
|
||||
noLoop();
|
||||
}
|
||||
|
||||
static public void main(String[] passedArgs) {
|
||||
String[] appletArgs = new String[] { "staticclass" };
|
||||
if (passedArgs != null) {
|
||||
PApplet.main(concat(appletArgs, passedArgs));
|
||||
} else {
|
||||
PApplet.main(appletArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
19
java/test/resources/staticclass.pde
Normal file
19
java/test/resources/staticclass.pde
Normal file
@@ -0,0 +1,19 @@
|
||||
class Button {
|
||||
|
||||
int x, y, radius;
|
||||
|
||||
public Button (int x, int y, int radius) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
boolean over() {
|
||||
return dist(mouseX, mouseY, this.x, this.y) < this.radius;
|
||||
}
|
||||
|
||||
void draw() {
|
||||
ellipse(this.x, this.y, this.radius * 2, this.radius * 2);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user