diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2013-08-26 02:40:15 +0000 |
|---|---|---|
| committer | Jon A. Cruz <jon@joncruz.org> | 2013-08-26 02:40:15 +0000 |
| commit | 205e7c81bd2f536b394a0786111bf60c0aac1df6 (patch) | |
| tree | 888bd3d8b4ac5421040f33bc42b4ab78b2772b2e /src | |
| parent | German translation update (diff) | |
| download | inkscape-205e7c81bd2f536b394a0786111bf60c0aac1df6.tar.gz inkscape-205e7c81bd2f536b394a0786111bf60c0aac1df6.zip | |
Updating outdated test. Fixes bug #1202271.
Fixed bugs:
- https://launchpad.net/bugs/1202271
(bzr r12487)
Diffstat (limited to 'src')
| -rw-r--r-- | src/preferences-test.h | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/preferences-test.h b/src/preferences-test.h index 8e8ddb65b..92cb14247 100644 --- a/src/preferences-test.h +++ b/src/preferences-test.h @@ -18,7 +18,7 @@ public: TestObserver(Glib::ustring const &path) : Inkscape::Preferences::Observer(path), value(0) {} - + virtual void notify(Inkscape::Preferences::Entry const &val) { value = val.getInt(); @@ -35,29 +35,29 @@ public: prefs = NULL; Inkscape::Preferences::unload(); } - + void testStartingState() { - TS_ASSERT(prefs != NULL); - TS_ASSERT_EQUALS(prefs->isWritable(), false); + TS_ASSERT_DIFFERS(prefs, static_cast<void*>(0)); + TS_ASSERT_EQUALS(prefs->isWritable(), true); } - + void testOverwrite() { prefs->setInt("/test/intvalue", 123); prefs->setInt("/test/intvalue", 321); TS_ASSERT_EQUALS(prefs->getInt("/test/intvalue"), 321); } - + void testDefaultReturn() { TS_ASSERT_EQUALS(prefs->getInt("/this/path/does/not/exist", 123), 123); } - + void testLimitedReturn() { prefs->setInt("/test/intvalue", 1000); - + // simple case TS_ASSERT_EQUALS(prefs->getIntLimited("/test/intvalue", 123, 0, 500), 123); // the below may seem quirky but this behaviour is intended @@ -66,7 +66,7 @@ public: TS_ASSERT_EQUALS(prefs->getIntLimited("/test/intvalue", 123, 0, 1000), 1000); TS_ASSERT_EQUALS(prefs->getIntLimited("/test/intvalue", 123, 1000, 5000), 1000); } - + void testKeyObserverNotification() { Glib::ustring const path = "/some/random/path"; @@ -74,18 +74,18 @@ public: obs.value = 1; prefs->setInt(path, 5); TS_ASSERT_EQUALS(obs.value, 1); // no notifications sent before adding - + prefs->addObserver(obs); prefs->setInt(path, 10); TS_ASSERT_EQUALS(obs.value, 10); prefs->setInt("/some/other/random/path", 10); TS_ASSERT_EQUALS(obs.value, 10); // value should not change - + prefs->removeObserver(obs); prefs->setInt(path, 15); TS_ASSERT_EQUALS(obs.value, 10); // no notifications sent after removal } - + void testEntryObserverNotification() { Glib::ustring const path = "/some/random/path"; @@ -93,11 +93,11 @@ public: obs.value = 1; prefs->setInt(path, 5); TS_ASSERT_EQUALS(obs.value, 1); // no notifications sent before adding - + prefs->addObserver(obs); prefs->setInt(path, 10); TS_ASSERT_EQUALS(obs.value, 10); - + // test that filtering works properly prefs->setInt("/some/random/value", 1234); TS_ASSERT_EQUALS(obs.value, 10); @@ -105,12 +105,12 @@ public: TS_ASSERT_EQUALS(obs.value, 10); prefs->setInt("/some/random/path2", 1234); TS_ASSERT_EQUALS(obs.value, 10); - + prefs->removeObserver(obs); prefs->setInt(path, 15); TS_ASSERT_EQUALS(obs.value, 10); // no notifications sent after removal } - + void testPreferencesEntryMethods() { prefs->setInt("/test/prefentry", 100); |
