mirror of
https://github.com/jneug/zeichenmaschine.git
synced 2026-10-12 01:45:18 +02:00
Klasse Constants kommentiert und refactored
This commit is contained in:
@@ -72,22 +72,22 @@ class ConstantsTest {
|
||||
|
||||
@Test
|
||||
void b() {
|
||||
assertTrue(Constants.getBool(true));
|
||||
assertFalse(Constants.getBool(false));
|
||||
assertTrue(Constants.getBool(1));
|
||||
assertFalse(Constants.getBool(0));
|
||||
assertTrue(Constants.getBool(4.0));
|
||||
assertFalse(Constants.getBool(0.0));
|
||||
assertTrue(Constants.getBool(4.0f));
|
||||
assertFalse(Constants.getBool(0.0f));
|
||||
assertTrue(Constants.getBool(4L));
|
||||
assertFalse(Constants.getBool(0L));
|
||||
assertTrue(Constants.getBool("true"));
|
||||
assertTrue(Constants.getBool("True"));
|
||||
assertFalse(Constants.getBool("1"));
|
||||
assertFalse(Constants.getBool("false"));
|
||||
assertFalse(Constants.getBool("yes"));
|
||||
assertFalse(Constants.getBool("no"));
|
||||
assertTrue(Constants.asBool(true));
|
||||
assertFalse(Constants.asBool(false));
|
||||
assertTrue(Constants.asBool(1));
|
||||
assertFalse(Constants.asBool(0));
|
||||
assertTrue(Constants.asBool(4.0));
|
||||
assertFalse(Constants.asBool(0.0));
|
||||
assertTrue(Constants.asBool(4.0f));
|
||||
assertFalse(Constants.asBool(0.0f));
|
||||
assertTrue(Constants.asBool(4L));
|
||||
assertFalse(Constants.asBool(0L));
|
||||
assertTrue(Constants.asBool("true"));
|
||||
assertTrue(Constants.asBool("True"));
|
||||
assertFalse(Constants.asBool("1"));
|
||||
assertFalse(Constants.asBool("false"));
|
||||
assertFalse(Constants.asBool("yes"));
|
||||
assertFalse(Constants.asBool("no"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -38,7 +38,7 @@ public class TestAttraction extends Zeichenmaschine {
|
||||
posC = new Vector(200, 100);
|
||||
velC = new Vector(1, 14);
|
||||
|
||||
drawing.translate(width /2, height /2);
|
||||
drawing.translate(canvasWidth /2, canvasHeight /2);
|
||||
drawing.shear(0.1, 0.5);
|
||||
|
||||
recht = new Rectangle(50, 50, 150, 75);
|
||||
@@ -84,7 +84,7 @@ public class TestAttraction extends Zeichenmaschine {
|
||||
|
||||
shapes.clear();
|
||||
double x = recht.getX();
|
||||
x = (x+100*delta)% width;
|
||||
x = (x+100*delta)% canvasWidth;
|
||||
recht.setX(x);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import schule.ngb.zm.shapes.Rectangle;
|
||||
import schule.ngb.zm.shapes.Shape;
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.Random;
|
||||
|
||||
public class TestShapes extends Zeichenmaschine {
|
||||
|
||||
@@ -65,7 +64,7 @@ public class TestShapes extends Zeichenmaschine {
|
||||
|
||||
public void shapePositions() {
|
||||
int pad = 24;
|
||||
Rectangle bounds = new Rectangle(pad, pad, width-pad, height-pad);
|
||||
Rectangle bounds = new Rectangle(pad, pad, canvasWidth -pad, canvasHeight -pad);
|
||||
|
||||
Rectangle[] rects = new Rectangle[5];
|
||||
for( int i = 0; i < rects.length; i++ ) {
|
||||
|
||||
Reference in New Issue
Block a user