Changeset View
Changeset View
Standalone View
Standalone View
autotests/kconfigtest.cpp
Show First 20 Lines • Show All 742 Lines • ▼ Show 20 Line(s) | |||||
743 | } | 743 | } | ||
744 | 744 | | |||
745 | void KConfigTest::testChangeGroup() | 745 | void KConfigTest::testChangeGroup() | ||
746 | { | 746 | { | ||
747 | KConfig sc(TEST_SUBDIR "kconfigtest"); | 747 | KConfig sc(TEST_SUBDIR "kconfigtest"); | ||
748 | KConfigGroup sc3(&sc, "Hello"); | 748 | KConfigGroup sc3(&sc, "Hello"); | ||
749 | QCOMPARE(sc3.name(), QString("Hello")); | 749 | QCOMPARE(sc3.name(), QString("Hello")); | ||
750 | KConfigGroup newGroup(sc3); | 750 | KConfigGroup newGroup(sc3); | ||
751 | #ifndef KDE_NO_DEPRECATED | 751 | #if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) | ||
752 | newGroup.changeGroup("FooBar"); // deprecated! | 752 | newGroup.changeGroup("FooBar"); // deprecated! | ||
753 | QCOMPARE(newGroup.name(), QString("FooBar")); | 753 | QCOMPARE(newGroup.name(), QString("FooBar")); | ||
754 | QCOMPARE(sc3.name(), QString("Hello")); // unchanged | 754 | QCOMPARE(sc3.name(), QString("Hello")); // unchanged | ||
755 | 755 | | |||
756 | // Write into the "changed group" and check that it works | 756 | // Write into the "changed group" and check that it works | ||
757 | newGroup.writeEntry("InFooBar", "FB"); | 757 | newGroup.writeEntry("InFooBar", "FB"); | ||
758 | QCOMPARE(KConfigGroup(&sc, "FooBar").entryMap().value("InFooBar"), QString("FB")); | 758 | QCOMPARE(KConfigGroup(&sc, "FooBar").entryMap().value("InFooBar"), QString("FB")); | ||
759 | QCOMPARE(KConfigGroup(&sc, "Hello").entryMap().value("InFooBar"), QString()); | 759 | QCOMPARE(KConfigGroup(&sc, "Hello").entryMap().value("InFooBar"), QString()); | ||
760 | #endif | 760 | #endif | ||
761 | 761 | | |||
762 | KConfigGroup rootGroup(sc.group("")); | 762 | KConfigGroup rootGroup(sc.group("")); | ||
763 | QCOMPARE(rootGroup.name(), QString("<default>")); | 763 | QCOMPARE(rootGroup.name(), QString("<default>")); | ||
764 | KConfigGroup sc32(rootGroup.group("Hello")); | 764 | KConfigGroup sc32(rootGroup.group("Hello")); | ||
765 | QCOMPARE(sc32.name(), QString("Hello")); | 765 | QCOMPARE(sc32.name(), QString("Hello")); | ||
766 | KConfigGroup newGroup2(sc32); | 766 | KConfigGroup newGroup2(sc32); | ||
767 | #ifndef KDE_NO_DEPRECATED | 767 | #if KCONFIGCORE_ENABLE_DEPRECATED_SINCE(5, 0) | ||
768 | newGroup2.changeGroup("FooBar"); // deprecated! | 768 | newGroup2.changeGroup("FooBar"); // deprecated! | ||
769 | QCOMPARE(newGroup2.name(), QString("FooBar")); | 769 | QCOMPARE(newGroup2.name(), QString("FooBar")); | ||
770 | QCOMPARE(sc32.name(), QString("Hello")); // unchanged | 770 | QCOMPARE(sc32.name(), QString("Hello")); // unchanged | ||
771 | #endif | 771 | #endif | ||
772 | } | 772 | } | ||
773 | 773 | | |||
774 | // Simple test for deleteEntry | 774 | // Simple test for deleteEntry | ||
775 | void KConfigTest::testDeleteEntry() | 775 | void KConfigTest::testDeleteEntry() | ||
▲ Show 20 Lines • Show All 1179 Lines • Show Last 20 Lines |