Klasse Constants kommentiert und refactored

This commit is contained in:
ngb
2022-07-12 23:22:35 +02:00
parent ec8e5cea91
commit 740bb37279
11 changed files with 1086 additions and 234 deletions

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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++ ) {