From e37d4911c750550896c4155f452736200d977b83 Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Mon, 16 Jan 2023 02:51:22 -0500 Subject: Almost done... --- tests.cpp | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) (limited to 'tests.cpp') diff --git a/tests.cpp b/tests.cpp index e3a283c..9a2f359 100644 --- a/tests.cpp +++ b/tests.cpp @@ -197,6 +197,74 @@ void Tests::tests_unitaires_couche() { // Tests sur la classe Canevas {{{ void Tests::tests_unitaires_canevas() { + cout << "----- Tests de la classe Canevas -----\n\n"; + + cout << "--- Initialisation d'un canevas ---\n"; + Canevas c1; + cout << "Couches: "; + c1.getEtats(cout); + cout << "Affichage: {\n"; + c1.afficher(cout); + cout << "}\n\n"; + + cout << "--- Ajout d'une forme (doit aller dans la couche 0) ---\n"; + cout << "Couches: "; + c1.getEtats(cout); + cout << "Reussite: " << (c1.ajouterForme(new Carre())? "Oui":"Non") + << "\nAffichage: {\n"; + c1.afficher(cout); + cout << "}\n\n"; + + cout << "--- Activation de la couche 3 ---\n"; + cout << "Reussite: " << (c1.activerCouche(3)? "Oui":"Non") + << "\nCouches: "; + c1.getEtats(cout); + cout << "Affichage: {\n"; + c1.afficher(cout); + cout << "}\n\n"; + + cout << "--- Ajout de forme (doit aller dans la couche 3) ---\n"; + cout << "Reussite: " << (c1.ajouterForme(new Carre())? "Oui":"Non") + << "\nCouches: "; + c1.getEtats(cout); + cout << "Affichage: {\n"; + c1.afficher(cout); + cout << "}\n\n"; + + cout << "--- Reinitialisation de la couche active (3) ---\n"; + cout << "Reussite: " << (c1.reinitialiserCouche(3)? "Oui":"Non") + << "\nCouches: "; + c1.getEtats(cout); + cout << "Affichage: {\n"; + c1.afficher(cout); + cout << "}\n\n"; + + cout << "--- Translation de couche initialisée (couche 3 par 1,2) ---\n"; + cout << "Reussite: " << (c1.translater(1, 2)? "Oui":"Non") + << "\nCouches: "; + c1.getEtats(cout); + cout << "Affichage: {\n"; + c1.afficher(cout); + cout << "}\n\n"; + + cout << "--- Translation d'une couche active (couche 0 par 1,2) ---\n"; + c1.activerCouche(0); + cout << "Reussite: " << (c1.translater(1, 2)? "Oui":"Non") + << "\nCouches: "; + c1.getEtats(cout); + cout << "Affichage: {\n"; + c1.afficher(cout); + cout << "}\n\n"; + + cout << "--- Réinitialisation du canevas ---\n"; + cout << "Reussite: " << (c1.reinitialiser()? "Oui":"Non") + << "\nCouches: "; + c1.getEtats(cout); + cout << "Affichage: {\n"; + c1.afficher(cout); + cout << "}\n"; + + }; // }}} // Execution de tout les tests unitaires {{{ -- cgit v1.2.3