From 39bda3064e75a8a4be100afa4f5e7adee33c2f17 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Mon, 1 Jul 2019 14:44:34 -0700 Subject: Update changelog and add post setter test --- .../androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt | 12 +++++++++++- docs/Changelog.md | 2 ++ sample/src/main/res/xml/kau_changelog.xml | 4 ++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt b/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt index 735302c..143b83f 100644 --- a/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt +++ b/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt @@ -41,11 +41,15 @@ class KPrefTest { initialize(ApplicationProvider.getApplicationContext(), "kpref_test_${System.currentTimeMillis()}") } + var postSetterCount: Int = 0 + var one by kpref("one", 1) var two by kpref("two", 2f) - var `true` by kpref("true", true) + var `true` by kpref("true", true, postSetter = { + postSetterCount++ + }) var hello by kpref("hello", "hello") @@ -113,4 +117,10 @@ class KPrefTest { assertPrefEquals(true, { oneShot }) assertPrefEquals(false, { androidPref.oneShot }) } + + @Test + fun postSetter() { + pref { `true` = true } + assertPrefEquals(1, { postSetterCount }, "Post setter was not called") + } } diff --git a/docs/Changelog.md b/docs/Changelog.md index 0ccf69c..b282830 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -3,6 +3,8 @@ ## v5.0.1 * :adapter: Moved fastadapter elements to new module, :fastadapter:. To migrate, simply rename the dependency. If you don't use fast adapter, no changes are necessary * :adapter: Make NoAnimatorChange an object; previously a class +* :core: KPref now supports in memory only variants for testing; pass KPrefBuilderInMemory to KPref constructor +* :core: KPref initializer takes in SharedPreferences so user can configure it ## v5.0.0 * Update Android SDK to 29 and Kotlin to 1.3.31 diff --git a/sample/src/main/res/xml/kau_changelog.xml b/sample/src/main/res/xml/kau_changelog.xml index 0e38015..6144685 100644 --- a/sample/src/main/res/xml/kau_changelog.xml +++ b/sample/src/main/res/xml/kau_changelog.xml @@ -9,8 +9,8 @@ - - + + -- cgit v1.2.3