From 7ba1d4459e0803c484b20bf46aa4ad309451160a Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Thu, 22 Aug 2024 18:29:38 -0400 Subject: [PATCH] Add tests for more profile management Adding and removing profiles, and some of the profile index functions. --- autotests/profilemanagertest.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/autotests/profilemanagertest.cpp b/autotests/profilemanagertest.cpp index f189cf8..98b613c 100644 --- a/autotests/profilemanagertest.cpp +++ b/autotests/profilemanagertest.cpp @@ -21,6 +21,32 @@ private Q_SLOTS: QCOMPARE(profileManager.rowCount({}), 1); QCOMPARE(profileManager.numProfiles(), 1); QVERIFY(!profileManager.canDelete(profileManager.getProfile(0))); // the first profile can never be deleted + + auto profile = profileManager.getProfile(0); + + QCOMPARE(profileManager.getProfileByUUID(profile->uuid()), profile); + QCOMPARE(profileManager.getProfileIndex(profile->uuid()), 0); + + QVERIFY(!profileManager.hasAnyExistingInstallations()); + } + + void testProfileManagement() + { + ProfileManager profileManager; + + QCOMPARE(profileManager.rowCount({}), 0); + profileManager.load(); + + profileManager.addProfile(); + + QCOMPARE(profileManager.rowCount({}), 2); + QCOMPARE(profileManager.numProfiles(), 2); + QVERIFY(profileManager.canDelete(profileManager.getProfile(1))); + + profileManager.deleteProfile(profileManager.getProfile(1)); + + QCOMPARE(profileManager.rowCount({}), 1); + QCOMPARE(profileManager.numProfiles(), 1); } };