Add the two test case.
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 15 Feb 2018 13:03:09 +0000 (14:03 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 15 Feb 2018 13:03:09 +0000 (14:03 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
TP2/Main.java

index 2abace9df825894c07320613b37b24ae71e541f0..64a54e79985048dbd29e4c503318efe10e2aa089 100644 (file)
@@ -1,9 +1,7 @@
 
-
 class Main {
 
-    public static void main(String[] args) {
-
+    private static void main1() {
         Point p1 = new Point(1, 2);
         Point p2 = new Point(2, 7);
         Segment segment = new Segment(p1, p2);
@@ -11,15 +9,61 @@ class Main {
         Cercle cercle = new Cercle(p3, 5.2);
         Point p4 = new Point(2, 3);
         Piletransformations trans = new Piletransformations(10);
+
         boolean rt = trans.empiler(p4);
 
         segment.dessiner(trans);
         cercle.dessiner(trans);
 
+        Point p5 = new Point(3, 5);
+        segment.deplacer(p5);
+        cercle.deplacer(p5);
+
         Image image = new Image();
         image.ajouter(segment);
         image.ajouter(cercle);
         image.dessiner(trans);
+        image.deplacer(p5);
+        image.dessiner(trans);
+
+        trans.depiler();
+    }
+
+    private static void main2() {
+        Point p1 = new Point(1, 2);
+        Point p2 = new Point(2, 7);
+        Segment segment1 = new Segment(p1, p2);
+        Point p3 = new Point(1, 5);
+        Point p4 = new Point(3, 1);
+        Segment segment2 = new Segment(p3, p4);
+        Point p5 = new Point(4, 5);
+        Cercle cercle1 = new Cercle(p5, 5.2);
+        Point p6 = new Point(5, 4);
+        Cercle cercle2 = new Cercle(p6, 4.3);
+        Point point1 = new Point(8, -1.5);
+        Image image1 = new Image();
+        Image image2 = new Image();
+        Image image3 = new Image();
+        Piletransformations transformations = new Piletransformations(10);
+
+        transformations.empiler(point1);
+        image1.ajouter(segment1);
+        image1.ajouter(cercle1);
+        image2.ajouter(segment2);
+        image2.ajouter(cercle2);
+        image1.dessiner(transformations);
+        image2.dessiner(transformations);
+        Point point2 = new Point(0.5, 2.5);
+        image1.deplacer(point2);
+        image2.ajouter(image1);
+        image2.dessiner(transformations);
+        transformations.depiler();
+    }
+
+    public static void main(String[] args) {
+
+        main2();
+
     }
 
 }