Skip to content

Commit 9ea128c

Browse files
author
A Samuel Pottinger
committed
Add failing test for static mode class defintion.
1 parent 9b19e4a commit 9ea128c

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,4 +443,9 @@ public void testMultiMultilineString() {
443443
expectGood("fullscreen_export");
444444
}
445445

446+
@Test
447+
public void testStaticClass() {
448+
expectGood("staticclass");
449+
}
450+
446451
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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 staticclass extends PApplet {
16+
public void setup() {
17+
class Button {
18+
19+
int x, y, radius;
20+
21+
public Button (int x, int y, int radius) {
22+
this.x = x;
23+
this.y = y;
24+
this.radius = radius;
25+
}
26+
27+
public boolean over() {
28+
return dist(mouseX, mouseY, this.x, this.y) < this.radius;
29+
}
30+
31+
public void draw() {
32+
ellipse(this.x, this.y, this.radius * 2, this.radius * 2);
33+
}
34+
35+
}
36+
noLoop();
37+
}
38+
39+
static public void main(String[] passedArgs) {
40+
String[] appletArgs = new String[] { "staticclass" };
41+
if (passedArgs != null) {
42+
PApplet.main(concat(appletArgs, passedArgs));
43+
} else {
44+
PApplet.main(appletArgs);
45+
}
46+
}
47+
}

java/test/resources/staticclass.pde

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class Button {
2+
3+
int x, y, radius;
4+
5+
public Button (int x, int y, int radius) {
6+
this.x = x;
7+
this.y = y;
8+
this.radius = radius;
9+
}
10+
11+
boolean over() {
12+
return dist(mouseX, mouseY, this.x, this.y) < this.radius;
13+
}
14+
15+
void draw() {
16+
ellipse(this.x, this.y, this.radius * 2, this.radius * 2);
17+
}
18+
19+
}

0 commit comments

Comments
 (0)