Skip to content

Commit fb24f7c

Browse files
committed
minor fixes and additional tests
1 parent 5f60f5b commit fb24f7c

14 files changed

Lines changed: 232 additions & 87 deletions

File tree

sources/net.sf.j2s.core/test/src/a2s/Canvas.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import java.awt.Graphics;
44

5+
import javax.swing.JComponent;
6+
57

68
public class Canvas extends Panel {
79

@@ -15,7 +17,7 @@ public void paint(Graphics g) {
1517
//BH AWT called canvas.update(g), but Swing will call canvas.paint(g) instead.
1618
//BH a2s does allow for that, with paint(g) calling update(g) (Opposite of standard Swing).
1719

18-
//BH So in the code, and canvas.paint should be renamed something like canvas.paintMe
20+
//BH So in the code, canvas.paint should be renamed something like canvas.paintMe
1921

2022

2123
update(g);
@@ -30,7 +32,7 @@ public void update(Graphics g) {
3032
/**
3133
* @j2sNative
3234
*
33-
* this.paintComponent && this.paintComponent(g);
35+
* this.paintComponent$java_awt_Graphics && this.paintComponent$java_awt_Graphics(g);
3436
*
3537
*/
3638
{}

sources/net.sf.j2s.core/test/src/com/falstad/Diffraction.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
import java.awt.Image;
5151
import java.awt.Insets;
5252
import java.awt.LayoutManager;
53-
import java.awt.Point;
5453
import java.awt.event.ActionEvent;
5554
import java.awt.event.ActionListener;
5655
import java.awt.event.AdjustmentEvent;
@@ -71,7 +70,6 @@
7170
import java.util.Vector;
7271

7372
import a2s.Applet;
74-
7573
import a2s.Button;
7674
import a2s.Canvas;
7775
import a2s.Checkbox;
@@ -686,19 +684,19 @@ void updateDiffraction(Graphics realg) {
686684
boolean hideFunction = dragging && aperture.hideWhileDragging();
687685
if (functionChanged) {
688686
realg.setColor(cv.getBackground());
689-
FontMetrics fm = realg.getFontMetrics();
690-
String cs = "Calculating...";
691-
realg.fillRect(0, fullWinSize.height - 30, 20 + fm.stringWidth(cs), 30);
692-
realg.setColor(Color.white);
693-
realg.drawString(cs, 10, fullWinSize.height - 10);
687+
// BH this does not seem necessary and is not cleared properly and is in the wrong spot
688+
// FontMetrics fm = realg.getFontMetrics();
689+
// String cs = "Calculating...";
690+
// realg.fillRect(0, cv.getHeight() - 30, 20 + fm.stringWidth(cs), 30);
691+
// realg.setColor(Color.white);
692+
// realg.drawString(cs, 10, cv.getHeight() - 10);
694693
computeFunction();
695694
}
696695

697696
Graphics g = null;
698697
if (winSize == null || winSize.width == 0)
699698
return;
700699
g = dbimage.getGraphics();
701-
g.setColor(cv.getBackground());
702700
g.fillRect(0, 0, fullWinSize.width, fullWinSize.height);
703701
g.setColor(cv.getForeground());
704702

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
(function(){var P$=Clazz.newPackage$("edu.colorado.phet.assets");
2+
var C$=Clazz.newClass$(P$, "Assetsa");
3+
4+
5+
Clazz.newMethod$(C$, '$init$', function () {
6+
}, 1);
7+
8+
Clazz.newMethod$(C$, 'main', function (args) {
9+
}, 1);
10+
11+
Clazz.newMethod$(C$);
12+
})();
13+
//Created 2017-12-05 20:16:21
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package function;
2+
3+
public class Exception1 extends Exception {
4+
5+
}

sources/net.sf.j2s.core/test/src/javajs/util/JSThread.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ protected void run1(int state) {
174174

175175
/**
176176
*
177-
* @param r
177+
* @param r2
178178
* @param state
179179
* @return true if we should interrupt (i.e. JavaScript)
180180
* @throws InterruptedException

sources/net.sf.j2s.core/test/src/test/Test_.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ abstract class Test_ {
1212
private static int i_ = 0;
1313
private int t = 0;
1414

15-
public void showt() {
15+
public int showt() {
1616
System.out.println(t);
17+
return t;
1718
}
1819
static {
1920
ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);

sources/net.sf.j2s.core/test/src/test/Test_Array.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class Test_Array extends Test_ {
1616
y = x;
1717
Test_Array[] a = new Test_Array[3];
1818
}
19+
static Object oo = Array.newInstance(Test_Array[].class, 0);
1920

2021
static Object tType3__ = Array.newInstance(Test_Array[][].class, 3);
2122
static Object oType3__ = Array.newInstance(Object[][].class, 3);
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package test;
2+
3+
public class Test_Catch extends Test_ {
4+
5+
6+
public static void main(String[] args) {
7+
try {
8+
new Test_Catch();
9+
} catch (Exception e) {
10+
if (e instanceof function.Exception1) {
11+
12+
}
13+
}
14+
System.out.println("Test_Catch OK");
15+
}
16+
17+
}

0 commit comments

Comments
 (0)