diff --git a/app/src/main/res/values-no-rNO/strings.xml b/app/src/main/res/values-nb-rNO/strings.xml
similarity index 98%
rename from app/src/main/res/values-no-rNO/strings.xml
rename to app/src/main/res/values-nb-rNO/strings.xml
index 807084700e..f02eea5d08 100644
--- a/app/src/main/res/values-no-rNO/strings.xml
+++ b/app/src/main/res/values-nb-rNO/strings.xml
@@ -9,7 +9,7 @@
Delta
Profil
Lagre
- Les inn profil på nytt
+ Last inn profil på nytt
Korreksjon
(FARLIG Å DEAKTIVERE) Kun NS opplasting
Kun NS opplasting (deaktivert sync). Ikke effektiv på SGV med mindre en lokal kilde som xDrip+ er valgt. Ikke effektiv på Profiler mens NS-Profiler brukes.\n!!! ADVARSEL !!! Deaktivering av dette alternativet kan føre til funksjonsfeil og overdosering av insulin hvis noen av dine komponenter (AAPS, NS, xDrip+) er feil konfigurert. Observer at data som vises i AAPS samsvarer med pumpestatus!
diff --git a/app/src/main/res/values-no-rNO/exam.xml b/app/src/main/res/values-no-rNO/exam.xml
deleted file mode 100644
index 3ea04e700d..0000000000
--- a/app/src/main/res/values-no-rNO/exam.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/app/src/main/res/values-no-rNO/objectives.xml b/app/src/main/res/values-no-rNO/objectives.xml
deleted file mode 100644
index 3ea04e700d..0000000000
--- a/app/src/main/res/values-no-rNO/objectives.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index 083ecf62c4..6bb3a1b3f9 100644
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -45,7 +45,7 @@
- it
- ko
- lt
- - no
+ - nb_NO
- pt
- pt_BR
- ro
diff --git a/build.gradle.kts b/build.gradle.kts
index a5054adc2c..81b1523444 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -12,20 +12,20 @@ buildscript {
set("rxkotlin_version", "3.0.1")
set("room_version", "2.5.2")
set("lifecycle_version", "2.6.2")
- set("dagger_version", "2.48")
+ set("dagger_version", "2.48.1")
set("coroutines_version", "1.7.3")
- set("activity_version", "1.7.2")
+ set("activity_version", "1.8.0")
set("fragmentktx_version", "1.6.1")
set("ormLite_version", "4.46")
set("gson_version", "2.10.1")
- set("nav_version", "2.7.3")
+ set("nav_version", "2.7.4")
set("appcompat_version", "1.6.1")
- set("material_version", "1.9.0")
+ set("material_version", "1.10.0")
set("gridlayout_version", "1.0.0")
set("constraintlayout_version", "2.1.4")
set("preferencektx_version", "1.2.1")
set("commonscodec_version", "1.16.0")
- set("guava_version", "32.1.2-jre")
+ set("guava_version", "32.1.3-jre")
set("jodatime_version", "2.12.5")
set("work_version", "2.8.1")
set("tink_version", "1.10.0")
@@ -35,7 +35,7 @@ buildscript {
set("junit_version", "4.13.2")
set("junit_jupiter_version", "5.10.0")
- set("mockito_version", "5.5.0")
+ set("mockito_version", "5.6.0")
set("dexmaker_version", "1.2")
set("retrofit2_version", "2.9.0")
set("okhttp3_version", "4.11.0")
@@ -74,7 +74,7 @@ buildscript {
}
plugins {
- id("org.jlleitschuh.gradle.ktlint") version "11.6.0"
+ id("org.jlleitschuh.gradle.ktlint") version "11.6.1"
id("org.jetbrains.kotlin.android") version Libs.Kotlin.kotlin apply false
}
diff --git a/buildSrc/src/main/kotlin/Libs.kt b/buildSrc/src/main/kotlin/Libs.kt
index 5b65fb7495..f4d4515c51 100644
--- a/buildSrc/src/main/kotlin/Libs.kt
+++ b/buildSrc/src/main/kotlin/Libs.kt
@@ -32,7 +32,7 @@ object Libs {
object Dagger {
- private const val version = "2.48"
+ private const val version = "2.48.1"
const val dagger = "com.google.dagger:dagger:$version"
const val android = "com.google.dagger:dagger-android:$version"
const val androidProcessor = "com.google.dagger:dagger-android-processor:$version"
@@ -68,18 +68,18 @@ object Libs {
const val room = "2.5.2"
const val lifecycle = "2.6.2"
const val coroutines = "1.7.3"
- const val activity = "1.7.2"
+ const val activity = "1.8.0"
const val fragmentktx = "1.6.1"
const val ormLite = "4.46"
const val gson = "2.10.1"
- const val nav = "2.7.3"
- const val material = "1.9.0"
+ const val nav = "2.7.4"
+ const val material = "1.10.0"
const val gridlayout = "1.0.0"
const val constraintlayout = "2.1.4"
const val preferencektx = "1.2.1"
const val commonslang3 = "3.13.0"
const val commonscodec = "1.16.0"
- const val guava = "32.1.2-jre"
+ const val guava = "32.1.3-jre"
const val work = "2.8.1"
const val tink = "1.10.0"
const val json = "20230618"
@@ -87,7 +87,7 @@ object Libs {
const val junit = "4.13.2"
const val junit_jupiter = "5.10.0"
- const val mockito = "5.5.0"
+ const val mockito = "5.6.0"
const val dexmaker = "1.2"
const val retrofit2 = "2.9.0"
const val okhttp3 = "4.11.0"
diff --git a/core/interfaces/src/main/kotlin/app/aaps/core/interfaces/notifications/Notification.kt b/core/interfaces/src/main/kotlin/app/aaps/core/interfaces/notifications/Notification.kt
index ba138abaf8..f9eb549c7b 100644
--- a/core/interfaces/src/main/kotlin/app/aaps/core/interfaces/notifications/Notification.kt
+++ b/core/interfaces/src/main/kotlin/app/aaps/core/interfaces/notifications/Notification.kt
@@ -138,6 +138,7 @@ open class Notification {
const val PUMP_SETTINGS_FAILED = 84
const val PUMP_TIMEZONE_UPDATE_FAILED = 85
const val BLUETOOTH_NOT_SUPPORTED = 86
+ const val PUMP_WARNING = 87
const val USER_MESSAGE = 1000
diff --git a/core/interfaces/src/main/kotlin/app/aaps/core/interfaces/rx/weardata/CustomWatchfaceFormat.kt b/core/interfaces/src/main/kotlin/app/aaps/core/interfaces/rx/weardata/CustomWatchfaceFormat.kt
index d48be7b3f9..d20837ca88 100644
--- a/core/interfaces/src/main/kotlin/app/aaps/core/interfaces/rx/weardata/CustomWatchfaceFormat.kt
+++ b/core/interfaces/src/main/kotlin/app/aaps/core/interfaces/rx/weardata/CustomWatchfaceFormat.kt
@@ -238,7 +238,23 @@ enum class JsonKeys(val key: String) {
ALLCAPS("allCaps"),
DAYNAMEFORMAT("dayNameFormat"),
MONTHFORMAT("monthFormat"),
- BACKGROUND("background")
+ BACKGROUND("background"), // Background image for textView
+ LEFTOFFSET("leftOffset"),
+ TOPOFFSET("topOffset"),
+ ROTATIONOFFSET("rotationOffset"),
+ DYNDATA("dynData"), //Bloc of DynDatas definition, and DynData keyValue within view
+ VALUEKEY("valueKey"), // Indentify which value (default is View Value)
+ MINDATA("minData"), // Min data Value (default defined for each value, note unit mg/dl for all bg, deltas)
+ MAXDATA("maxData"), // Max data idem min data (note all value below min or above max will be considered as equal min or mas)
+ MINVALUE("minValue"), // min returned value (when data value equals minData
+ MAXVALUE("maxValue"), //
+ INVALIDVALUE("invalidValue"),
+ IMAGE("image"),
+ INVALIDIMAGE("invalidImage"),
+ INVALIDCOLOR("invalidColor"),
+ TWINVIEW("twinView"),
+ TOPOFFSETTWINHIDDEN("topOffsetTwinHidden"),
+ LEFTOFFSETTWINHIDDEN("leftOffsetTwinHidden")
}
enum class JsonKeyValues(val key: String) {
@@ -260,7 +276,8 @@ enum class JsonKeyValues(val key: String) {
BOLD("bold"),
BOLD_ITALIC("bold_italic"),
ITALIC("italic"),
- BGCOLOR("bgColor")
+ BGCOLOR("bgColor"),
+ SGVLEVEL("sgvLevel")
}
class ZipWatchfaceFormat {
diff --git a/core/interfaces/src/main/res/values-iw-rIL/strings.xml b/core/interfaces/src/main/res/values-iw-rIL/strings.xml
index 93ccb4096c..a9843ae423 100644
--- a/core/interfaces/src/main/res/values-iw-rIL/strings.xml
+++ b/core/interfaces/src/main/res/values-iw-rIL/strings.xml
@@ -30,7 +30,7 @@
היום
אתמול
- חיבור אל %1$s
+ מתחבר במשך %1$d שניות
לוחץ יד
מחובר
מתנתק
diff --git a/core/interfaces/src/main/res/values-no-rNO/strings.xml b/core/interfaces/src/main/res/values-nb-rNO/strings.xml
similarity index 99%
rename from core/interfaces/src/main/res/values-no-rNO/strings.xml
rename to core/interfaces/src/main/res/values-nb-rNO/strings.xml
index 47694ea69b..f0d8eeb0e6 100644
--- a/core/interfaces/src/main/res/values-no-rNO/strings.xml
+++ b/core/interfaces/src/main/res/values-nb-rNO/strings.xml
@@ -54,7 +54,7 @@
Vis basalrate
Vis loop status
Vis BS
- Vis BS
+ Vis BGI
Vis retningspil
Vis tid siden
Vis ukenummer
diff --git a/core/main/src/main/res/values-no-rNO/strings.xml b/core/main/src/main/res/values-nb-rNO/strings.xml
similarity index 100%
rename from core/main/src/main/res/values-no-rNO/strings.xml
rename to core/main/src/main/res/values-nb-rNO/strings.xml
diff --git a/core/ui/src/main/res/values-iw-rIL/strings.xml b/core/ui/src/main/res/values-iw-rIL/strings.xml
index 62949f3c37..07c737f5f1 100644
--- a/core/ui/src/main/res/values-iw-rIL/strings.xml
+++ b/core/ui/src/main/res/values-iw-rIL/strings.xml
@@ -457,6 +457,7 @@
פחמ\' פעילות לעומת אינ\' פעיל
!!!!!! זוהתה ספיגת פחמימות איטית: %2$d%% מהזמן הצפוי. הערכת כמות הפחמימות הפעילות עלולה להיות ביתר ולכן תיתכן הזרקת אינסולין עודפת !!!!!!]]>
ספק את חלק זה מתוצאת אשף הבולוס [%]
+ סף זמן נתונים ישנים [דק\']
מגבלת בולוס יושמה: %1$.2f עד %2$.2f יח\'
בולוס רשום בלבד (לא מוזרק על ידי המשאבה)
הפעל התראה כשצריכים לאכול
@@ -586,7 +587,22 @@
האם ברצונכם לנקות את מסד הנתונים?\nשינויים הנמצאים במעקב ונתונים היסטוריים הישנים מ-3 חודשים יימחקו.\nפעולה זו תזרז משמעותית את מהירות הסינכרון המלא.
רשומות שנמחקו
+ א׳
+ ש\'
+ ו׳
+ ה\'
+ ד\'
+ ג\'
+ ב\'
+ ב\'
+ ג\'
+ ד\'
+ ה\'
+ ו\'
+ ש\'
+ א\'
+ %1$.1f יח\'
%1$.2f יח\'
diff --git a/core/ui/src/main/res/values-no-rNO/protection.xml b/core/ui/src/main/res/values-nb-rNO/protection.xml
similarity index 100%
rename from core/ui/src/main/res/values-no-rNO/protection.xml
rename to core/ui/src/main/res/values-nb-rNO/protection.xml
diff --git a/core/ui/src/main/res/values-no-rNO/strings.xml b/core/ui/src/main/res/values-nb-rNO/strings.xml
similarity index 97%
rename from core/ui/src/main/res/values-no-rNO/strings.xml
rename to core/ui/src/main/res/values-nb-rNO/strings.xml
index f3e1ef9956..e2d717ae04 100644
--- a/core/ui/src/main/res/values-no-rNO/strings.xml
+++ b/core/ui/src/main/res/values-nb-rNO/strings.xml
@@ -7,7 +7,7 @@
Ugyldige verdier
Leverer %1$.2f E
Begrensning benyttet!
- Total IOB:
+ Totalt IOB:
TT
Pumpe er utilgjengelig
E
@@ -64,7 +64,7 @@
Karbo
Ugyldig profil!
INGEN PROFIL VALGT
- ]]>
+ ]]>
Dato
Enheter
DIA
@@ -73,7 +73,7 @@
Basal
Målverdi
Insulinets virkningstid (DIA)
- Insulin- til karbohydratfaktor
+ Insulin-karbohydratfaktor (IK)
Insulin sensitivitetsfaktor (ISF)
Basalrate
Blodsukkermål
@@ -136,7 +136,7 @@
lavt
Gjennomsnitt
TIR
- ]]>
+ ]]>
FJERN
Aktiver profil
tilbakestill
@@ -146,7 +146,7 @@
Er du sikker på at du vil fjerne %1$d elementer
Behandling
Opprett ny profil fra denne profilen?
- Innstillinger for veiviser
+ Kalkulatorinnstillinger
15 min trend
COB
Bolus IOB
@@ -155,7 +155,7 @@
Login
Prime/fylling
Insulin
- Avbryt temp target
+ Avbryt midlertidig mål
Lukket Loop
Åpen Loop
Stopp ved lavt BS
@@ -220,10 +220,10 @@
Karbo-korreksjon
OpenAPS Offline
Bytte pumpebatteri
- Midlertidig BS-mål
+ Midlertidig mål
Midlertidig målverdi
Avbryt midl. mål
- Bolusassistent
+ Boluskalkulator
Finger
Sensor
Manuell
@@ -231,7 +231,7 @@
Spise snart
Hypo
Aktivitet
- Wear
+ Klokke
Automatisering
Egendefinert
Loop
@@ -453,10 +453,10 @@
INFO
Bolusveiviser
- Du har høyt blodsukker. I stedet for å spise nå er det bedre å utsette det til du har et lavere blodsukker. Ønsker du å sette en korreksjons bolus nå og få en påminnelse om når det er på tide å spise? I dette tilfellet vil ingen karbohydrater registreres nå, og du må bruke måltidsveiviseren igjen når vi gir deg en påminnelse.
+ Du har høyt blodsukker. I stedet for å spise nå er det bedre å utsette det til du har et lavere blodsukker. Ønsker du å sette en korreksjonsbolus nå og få en påminnelse om når det er på tide å spise? I dette tilfellet vil ingen karbohydrater registreres nå, og du må bruke boluskalkulatoren igjen når vi gir deg en påminnelse.
COB vs IOB
!! Advarsel: Oppdaget treg absorpsjon av karbohydrater: %2$d%% av tiden. Dobbeltsjekk din beregning. COB kan være misvisende og du risikerer å få for mye insulin !!]]>
- Doser denne delen av resultatet fra bolusveiviseren [%]
+ Doser denne delen av resultatet fra boluskalkulatoren [%]
Terskel for gammel BS-verdi [min]
Bolus begrensning brukt: %1$.2f E til %2$.2f E
Bolus vil bare bli loggført (ikke levert av pumpe)
@@ -478,7 +478,7 @@
TempT: %1$s
%1$s til %2$s
Ingen pumpe tilgjengelig!
- Hurtigveiviser
+ Hurtigknapp
Barn
Tenåring
@@ -486,8 +486,8 @@
Insulinresistent voksen
Graviditet
Velg pasienttype for oppsett av sikkerhetsgrenser
- Maks tillat bolus [U]
- Maks tillat karbo [g]
+ Maks tillatt bolus [U]
+ Maks tillatt karbohydrater [g]
Pasienttype
Lås opp innstillinger
diff --git a/core/validators/src/main/res/values-no-rNO/validator.xml b/core/validators/src/main/res/values-nb-rNO/validator.xml
similarity index 100%
rename from core/validators/src/main/res/values-no-rNO/validator.xml
rename to core/validators/src/main/res/values-nb-rNO/validator.xml
diff --git a/database/impl/src/main/java/app/aaps/database/impl/AppRepository.kt b/database/impl/src/main/java/app/aaps/database/impl/AppRepository.kt
index 0e82476a24..c5cb3fbcd4 100644
--- a/database/impl/src/main/java/app/aaps/database/impl/AppRepository.kt
+++ b/database/impl/src/main/java/app/aaps/database/impl/AppRepository.kt
@@ -105,23 +105,23 @@ import kotlin.math.roundToInt
removed.add(Pair("HeartRate", database.heartRateDao.deleteOlderThan(than)))
if (deleteTrackedChanges) {
- removed.add(Pair("GlucoseValue", database.glucoseValueDao.deleteTrackedChanges()))
- removed.add(Pair("TherapyEvent", database.therapyEventDao.deleteTrackedChanges()))
- removed.add(Pair("TemporaryBasal", database.temporaryBasalDao.deleteTrackedChanges()))
- removed.add(Pair("Bolus", database.bolusDao.deleteTrackedChanges()))
- removed.add(Pair("ExtendedBolus", database.extendedBolusDao.deleteTrackedChanges()))
- removed.add(Pair("MultiWaveBolus", database.multiwaveBolusLinkDao.deleteTrackedChanges()))
- // keep TDD removed.add(Pair("TotalDailyDose", database.totalDailyDoseDao.deleteTrackedChanges()))
- removed.add(Pair("Carbs", database.carbsDao.deleteTrackedChanges()))
- removed.add(Pair("TemporaryTarget", database.temporaryTargetDao.deleteTrackedChanges()))
- removed.add(Pair("ApsResultLink", database.apsResultLinkDao.deleteTrackedChanges()))
- removed.add(Pair("BolusCalculatorResult", database.bolusCalculatorResultDao.deleteTrackedChanges()))
- removed.add(Pair("EffectiveProfileSwitch", database.effectiveProfileSwitchDao.deleteTrackedChanges()))
- removed.add(Pair("ProfileSwitch", database.profileSwitchDao.deleteTrackedChanges()))
- removed.add(Pair("ApsResult", database.apsResultDao.deleteTrackedChanges()))
+ removed.add(Pair("CHANGES GlucoseValue", database.glucoseValueDao.deleteTrackedChanges()))
+ removed.add(Pair("CHANGES TherapyEvent", database.therapyEventDao.deleteTrackedChanges()))
+ removed.add(Pair("CHANGES TemporaryBasal", database.temporaryBasalDao.deleteTrackedChanges()))
+ removed.add(Pair("CHANGES Bolus", database.bolusDao.deleteTrackedChanges()))
+ removed.add(Pair("CHANGES ExtendedBolus", database.extendedBolusDao.deleteTrackedChanges()))
+ removed.add(Pair("CHANGES MultiWaveBolus", database.multiwaveBolusLinkDao.deleteTrackedChanges()))
+ // keep TDD removed.add(Pair("CHANGES TotalDailyDose", database.totalDailyDoseDao.deleteTrackedChanges()))
+ removed.add(Pair("CHANGES Carbs", database.carbsDao.deleteTrackedChanges()))
+ removed.add(Pair("CHANGES TemporaryTarget", database.temporaryTargetDao.deleteTrackedChanges()))
+ removed.add(Pair("CHANGES ApsResultLink", database.apsResultLinkDao.deleteTrackedChanges()))
+ removed.add(Pair("CHANGES BolusCalculatorResult", database.bolusCalculatorResultDao.deleteTrackedChanges()))
+ removed.add(Pair("CHANGES EffectiveProfileSwitch", database.effectiveProfileSwitchDao.deleteTrackedChanges()))
+ removed.add(Pair("CHANGES ProfileSwitch", database.profileSwitchDao.deleteTrackedChanges()))
+ removed.add(Pair("CHANGES ApsResult", database.apsResultDao.deleteTrackedChanges()))
// keep food database.foodDao.deleteHistory()
- removed.add(Pair("OfflineEvent", database.offlineEventDao.deleteTrackedChanges()))
- removed.add(Pair("HeartRate", database.heartRateDao.deleteTrackedChanges()))
+ removed.add(Pair("CHANGES OfflineEvent", database.offlineEventDao.deleteTrackedChanges()))
+ removed.add(Pair("CHANGES HeartRate", database.heartRateDao.deleteTrackedChanges()))
}
val ret = StringBuilder()
removed
diff --git a/implementation/src/main/kotlin/app/aaps/implementation/profile/ProfileFunctionImpl.kt b/implementation/src/main/kotlin/app/aaps/implementation/profile/ProfileFunctionImpl.kt
index 94d8603af7..b448214159 100644
--- a/implementation/src/main/kotlin/app/aaps/implementation/profile/ProfileFunctionImpl.kt
+++ b/implementation/src/main/kotlin/app/aaps/implementation/profile/ProfileFunctionImpl.kt
@@ -179,7 +179,7 @@ class ProfileFunctionImpl @Inject constructor(
override fun createProfileSwitch(durationInMinutes: Int, percentage: Int, timeShiftInHours: Int): Boolean {
val profile = repository.getPermanentProfileSwitch(dateUtil.now()) ?: return false
val profileStore = activePlugin.activeProfileSource.profile ?: return false
- val ps = buildProfileSwitch(profileStore, profile.profileName, durationInMinutes, percentage, 0, dateUtil.now()) ?: return false
+ val ps = buildProfileSwitch(profileStore, profile.profileName, durationInMinutes, percentage, timeShiftInHours, dateUtil.now()) ?: return false
val validity = ProfileSealed.PS(ps).isValid(
rh.gs(app.aaps.core.ui.R.string.careportal_profileswitch),
activePlugin.activePump,
diff --git a/implementation/src/main/res/values-no-rNO/strings.xml b/implementation/src/main/res/values-nb-rNO/strings.xml
similarity index 100%
rename from implementation/src/main/res/values-no-rNO/strings.xml
rename to implementation/src/main/res/values-nb-rNO/strings.xml
diff --git a/insight/src/main/res/values-no-rNO/alert_codes.xml b/insight/src/main/res/values-nb-rNO/alert_codes.xml
similarity index 100%
rename from insight/src/main/res/values-no-rNO/alert_codes.xml
rename to insight/src/main/res/values-nb-rNO/alert_codes.xml
diff --git a/insight/src/main/res/values-no-rNO/alert_descriptions.xml b/insight/src/main/res/values-nb-rNO/alert_descriptions.xml
similarity index 100%
rename from insight/src/main/res/values-no-rNO/alert_descriptions.xml
rename to insight/src/main/res/values-nb-rNO/alert_descriptions.xml
diff --git a/insight/src/main/res/values-no-rNO/alert_titles.xml b/insight/src/main/res/values-nb-rNO/alert_titles.xml
similarity index 100%
rename from insight/src/main/res/values-no-rNO/alert_titles.xml
rename to insight/src/main/res/values-nb-rNO/alert_titles.xml
diff --git a/insight/src/main/res/values-no-rNO/exceptions.xml b/insight/src/main/res/values-nb-rNO/exceptions.xml
similarity index 100%
rename from insight/src/main/res/values-no-rNO/exceptions.xml
rename to insight/src/main/res/values-nb-rNO/exceptions.xml
diff --git a/insight/src/main/res/values-no-rNO/strings.xml b/insight/src/main/res/values-nb-rNO/strings.xml
similarity index 100%
rename from insight/src/main/res/values-no-rNO/strings.xml
rename to insight/src/main/res/values-nb-rNO/strings.xml
diff --git a/plugins/aps/src/main/res/values-iw-rIL/strings.xml b/plugins/aps/src/main/res/values-iw-rIL/strings.xml
index f6ff9f650f..3841e48caf 100644
--- a/plugins/aps/src/main/res/values-iw-rIL/strings.xml
+++ b/plugins/aps/src/main/res/values-iw-rIL/strings.xml
@@ -83,6 +83,7 @@
SMB מושבת בהעדפות
UAM מושבת בהעדפות
Autosens מושבת בהעדפות
+ אוטוסנס כבוי ברגישות דינאמית
הגבלת IOB ל-%1$.1f יח\' בגלל %2$s
ערך מקסימלי בהעדפות
@@ -114,4 +115,5 @@
SMB מוגדר באמצעות משאבה
מינימום לבקשה לשינוי [%]
\"לולאה פתוחה\" תציג בקשת שינוי חדשה רק אם השינוי גדול מערך זה ב-%. ערך ברירת המחדל הוא 20%
+ חוזר ל-SMB, אין מספיק נתוני מינון יומי.
diff --git a/plugins/aps/src/main/res/values-lt-rLT/strings.xml b/plugins/aps/src/main/res/values-lt-rLT/strings.xml
index 5ff94077e3..0d6379ab16 100644
--- a/plugins/aps/src/main/res/values-lt-rLT/strings.xml
+++ b/plugins/aps/src/main/res/values-lt-rLT/strings.xml
@@ -83,6 +83,7 @@
SMB išjungti nustatymuose
NDM nustatymas išjungtas nustatymuose
Autosens funkcija išjungta nustatymuose
+ Autosens neveikia DynISF
Ribojamas AIO iki %1$.1f V dėl %2$s
Maksimali reikšmė nustatymuose
diff --git a/plugins/aps/src/main/res/values-no-rNO/strings.xml b/plugins/aps/src/main/res/values-nb-rNO/strings.xml
similarity index 100%
rename from plugins/aps/src/main/res/values-no-rNO/strings.xml
rename to plugins/aps/src/main/res/values-nb-rNO/strings.xml
diff --git a/plugins/aps/src/main/res/values-ru-rRU/strings.xml b/plugins/aps/src/main/res/values-ru-rRU/strings.xml
index 29406218f9..4c19f9fedd 100644
--- a/plugins/aps/src/main/res/values-ru-rRU/strings.xml
+++ b/plugins/aps/src/main/res/values-ru-rRU/strings.xml
@@ -83,6 +83,7 @@
Супер микро болюс SMB отключен в настройках
Непредвиденный прием пищи UAM отключен в настройках
Автоматический подбор чувствительности Autosens отключен в настройках
+ Autosens отключён в DynISF
Ограничение активного инсулина IOB до %1$.1f ед. из-за %2$s
максимальное значение в настройках
diff --git a/plugins/aps/src/main/res/values-sk-rSK/strings.xml b/plugins/aps/src/main/res/values-sk-rSK/strings.xml
index f504160375..ee7b42745a 100644
--- a/plugins/aps/src/main/res/values-sk-rSK/strings.xml
+++ b/plugins/aps/src/main/res/values-sk-rSK/strings.xml
@@ -83,6 +83,7 @@
SMB zakázané v nastaveniach
UAM zakázané v nastaveniach
Automatická detekcia citlivosti zakázaná v nastaveniach
+ Autosens zakázaný v DynISF
IOB obmedzený na %1$.1f JI: %2$s
maximálna hodnota v nastaveniach
diff --git a/plugins/automation/src/main/res/values-no-rNO/strings.xml b/plugins/automation/src/main/res/values-nb-rNO/strings.xml
similarity index 97%
rename from plugins/automation/src/main/res/values-no-rNO/strings.xml
rename to plugins/automation/src/main/res/values-nb-rNO/strings.xml
index b3c069256f..0b67c24fef 100644
--- a/plugins/automation/src/main/res/values-no-rNO/strings.xml
+++ b/plugins/automation/src/main/res/values-nb-rNO/strings.xml
@@ -113,7 +113,7 @@
Legg til regel
Stopp prosessering
- Nå må du spise!\nBruk bolusveiviser og gjør beregning på nytt.
- Tid for bolus!\nStart bolusveiviser og gjør beregning på nytt.
+ Nå må du spise!\nBruk boluskalkulator og gjør beregning på nytt.
+ Tid for bolus!\nStart boluskalkulator og gjør beregning på nytt.
Feil under innstilling av fremtidig alarm
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/AutomationEventTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/AutomationEventTest.kt
index 62c6ff9ef3..cf76da7f1a 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/AutomationEventTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/AutomationEventTest.kt
@@ -10,12 +10,13 @@ import app.aaps.plugins.automation.triggers.TriggerConnector
import app.aaps.plugins.automation.triggers.TriggerConnectorTest
import app.aaps.plugins.automation.triggers.TriggerDummy
import app.aaps.shared.tests.TestBase
+import com.google.common.truth.Truth.assertThat
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import org.json.JSONObject
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import org.mockito.Mock
+import org.skyscreamer.jsonassert.JSONAssert
class AutomationEventTest : TestBase() {
@@ -40,8 +41,7 @@ class AutomationEventTest : TestBase() {
}
}
- @Test
- fun testCloneEvent() {
+ @Test fun testCloneEvent() {
// create test object
val event = AutomationEventObject(injector)
event.title = "Test"
@@ -51,33 +51,32 @@ class AutomationEventTest : TestBase() {
// export to json
val eventJsonExpected =
"{\"userAction\":false,\"autoRemove\":false,\"readOnly\":false,\"trigger\":\"{\\\"data\\\":{\\\"connectorType\\\":\\\"AND\\\",\\\"triggerList\\\":[\\\"{\\\\\\\"data\\\\\\\":{\\\\\\\"connectorType\\\\\\\":\\\\\\\"AND\\\\\\\",\\\\\\\"triggerList\\\\\\\":[]},\\\\\\\"type\\\\\\\":\\\\\\\"TriggerConnector\\\\\\\"}\\\"]},\\\"type\\\":\\\"TriggerConnector\\\"}\",\"title\":\"Test\",\"systemAction\":false,\"actions\":[\"{\\\"type\\\":\\\"ActionLoopEnable\\\"}\"],\"enabled\":true}"
- Assertions.assertEquals(eventJsonExpected, event.toJSON())
+ JSONAssert.assertEquals(eventJsonExpected, event.toJSON(), true)
// clone
val clone = AutomationEventObject(injector).fromJSON(eventJsonExpected, 1)
// check title
- Assertions.assertEquals(event.title, clone.title)
+ assertThat(clone.title).isEqualTo(event.title)
// check trigger
- Assertions.assertNotNull(clone.trigger)
- Assertions.assertFalse(event.trigger === clone.trigger) // not the same object reference
- Assertions.assertEquals(event.trigger.javaClass, clone.trigger.javaClass)
- Assertions.assertEquals(event.trigger.toJSON(), clone.trigger.toJSON())
+ assertThat(clone.trigger).isNotNull()
+ assertThat(event.trigger).isNotSameInstanceAs(clone.trigger)
+ assertThat(event.trigger.javaClass).isNotInstanceOf(clone.trigger.javaClass)
+ JSONAssert.assertEquals(event.trigger.toJSON(), clone.trigger.toJSON(), true)
// check action
- Assertions.assertEquals(1, clone.actions.size)
- Assertions.assertFalse(event.actions === clone.actions) // not the same object reference
- Assertions.assertEquals(clone.toJSON(), clone.toJSON())
+ assertThat(clone.actions).hasSize(1)
+ assertThat(event.actions).isNotSameInstanceAs(clone.actions)
+ JSONAssert.assertEquals(clone.toJSON(), clone.toJSON(), true)
}
- @Test
- fun hasStopProcessing() {
+ @Test fun hasStopProcessing() {
val event = AutomationEventObject(injector)
event.title = "Test"
event.trigger = TriggerDummy(injector).instantiate(JSONObject(TriggerConnectorTest().oneItem)) as TriggerConnector
- Assertions.assertFalse(event.hasStopProcessing())
+ assertThat(event.hasStopProcessing()).isFalse()
event.addAction(ActionStopProcessing(injector))
- Assertions.assertTrue(event.hasStopProcessing())
+ assertThat(event.hasStopProcessing()).isTrue()
}
}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/BolusTimerImplTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/BolusTimerImplTest.kt
index 05c5a35952..d5bca898fe 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/BolusTimerImplTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/BolusTimerImplTest.kt
@@ -16,9 +16,9 @@ import app.aaps.plugins.automation.triggers.Trigger
import app.aaps.plugins.automation.ui.TimerUtil
import app.aaps.shared.impl.utils.DateUtilImpl
import app.aaps.shared.tests.TestBase
+import com.google.common.truth.Truth.assertThat
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.ArgumentMatchers.anyInt
@@ -63,10 +63,10 @@ class BolusTimerImplTest : TestBase() {
@Test
fun doTest() {
- Assertions.assertEquals(0, automationPlugin.size())
+ assertThat(automationPlugin.size()).isEqualTo(0)
automationPlugin.scheduleAutomationEventBolusReminder()
- Assertions.assertEquals(1, automationPlugin.size())
+ assertThat(automationPlugin.size()).isEqualTo(1)
automationPlugin.removeAutomationEventBolusReminder()
- Assertions.assertEquals(0, automationPlugin.size())
+ assertThat(automationPlugin.size()).isEqualTo(0)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/CarbTimerImplTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/CarbTimerImplTest.kt
index cdc4949442..a0ebc85a9b 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/CarbTimerImplTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/CarbTimerImplTest.kt
@@ -16,9 +16,9 @@ import app.aaps.plugins.automation.triggers.Trigger
import app.aaps.plugins.automation.ui.TimerUtil
import app.aaps.shared.impl.utils.DateUtilImpl
import app.aaps.shared.tests.TestBase
+import com.google.common.truth.Truth.assertThat
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.ArgumentMatchers.any
@@ -52,27 +52,24 @@ class CarbTimerImplTest : TestBase() {
private lateinit var automationPlugin: AutomationPlugin
- @BeforeEach
- fun init() {
+ @BeforeEach fun init() {
Mockito.`when`(rh.gs(anyInt())).thenReturn("")
Mockito.`when`(profileFunction.getUnits()).thenReturn(GlucoseUnit.MGDL)
dateUtil = DateUtilImpl(context)
timerUtil = TimerUtil(context)
automationPlugin = AutomationPlugin(
- injector, rh, context, sp, fabricPrivacy, loop, rxBus, constraintChecker, aapsLogger, aapsSchedulers, config, locationServiceHelper, dateUtil,
- activePlugin, timerUtil
+ injector, rh, context, sp, fabricPrivacy, loop, rxBus, constraintChecker, aapsLogger, aapsSchedulers, config, locationServiceHelper, dateUtil, activePlugin, timerUtil
)
}
- @Test
- fun doTest() {
- Assertions.assertEquals(0, automationPlugin.size())
+ @Test fun doTest() {
+ assertThat(automationPlugin.size()).isEqualTo(0)
automationPlugin.scheduleAutomationEventEatReminder()
- Assertions.assertEquals(1, automationPlugin.size())
+ assertThat(automationPlugin.size()).isEqualTo(1)
automationPlugin.removeAutomationEventEatReminder()
- Assertions.assertEquals(0, automationPlugin.size())
+ assertThat(automationPlugin.size()).isEqualTo(0)
automationPlugin.scheduleTimeToEatReminder(1)
Mockito.verify(context, Mockito.times(1)).startActivity(any())
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/ComposeTriggerTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/ComposeTriggerTest.kt
index ef6b8225df..f0c109595c 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/ComposeTriggerTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/ComposeTriggerTest.kt
@@ -4,14 +4,14 @@ import app.aaps.plugins.automation.triggers.Trigger
import app.aaps.plugins.automation.triggers.TriggerConnector
import app.aaps.plugins.automation.triggers.TriggerDummy
import app.aaps.shared.tests.TestBase
+import com.google.common.truth.Truth.assertThat
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
class ComposeTriggerTest : TestBase() {
- var injector: HasAndroidInjector = HasAndroidInjector { AndroidInjector { } }
+ val injector: HasAndroidInjector = HasAndroidInjector { AndroidInjector { } }
@Test fun testTriggerList() {
val root = TriggerConnector(injector)
@@ -23,16 +23,11 @@ class ComposeTriggerTest : TestBase() {
root.list.add(t1)
val t2: Trigger = TriggerDummy(injector)
root.list.add(t2)
- Assertions.assertEquals(3, root.size())
- Assertions.assertEquals(t0, root.list[0])
- Assertions.assertEquals(t1, root.list[1])
- Assertions.assertEquals(t2, root.list[2])
+ assertThat(root.list).containsExactly(t0, t1, t2).inOrder()
// remove a trigger
root.list.remove(t1)
- Assertions.assertEquals(2, root.size())
- Assertions.assertEquals(t0, root.list[0])
- Assertions.assertEquals(t2, root.list[1])
+ assertThat(root.list).containsExactly(t0, t2).inOrder()
}
@Test
@@ -44,6 +39,6 @@ class ComposeTriggerTest : TestBase() {
t[i] = TriggerDummy(injector)
root.list.add(t[i]!!)
}
- Assertions.assertEquals(4, root.size())
+ assertThat(root.size()).isEqualTo(4)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionAlarmTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionAlarmTest.kt
index a3f345f01d..96da47527a 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionAlarmTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionAlarmTest.kt
@@ -10,14 +10,15 @@ import app.aaps.plugins.automation.R
import app.aaps.plugins.automation.elements.InputString
import app.aaps.plugins.automation.ui.TimerUtil
import app.aaps.shared.tests.TestBase
+import com.google.common.truth.Truth.assertThat
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.ArgumentMatchers
import org.mockito.Mock
import org.mockito.Mockito.`when`
+import org.skyscreamer.jsonassert.JSONAssert
class ActionAlarmTest : TestBase() {
@@ -54,39 +55,39 @@ class ActionAlarmTest : TestBase() {
}
@Test fun friendlyNameTest() {
- Assertions.assertEquals(app.aaps.core.ui.R.string.alarm, sut.friendlyName())
+ assertThat(sut.friendlyName()).isEqualTo(app.aaps.core.ui.R.string.alarm)
}
@Test fun shortDescriptionTest() {
sut.text = InputString("Asd")
- Assertions.assertEquals("Alarm: %s", sut.shortDescription())
+ assertThat(sut.shortDescription()).isEqualTo("Alarm: %s")
}
@Test fun iconTest() {
- Assertions.assertEquals(app.aaps.core.main.R.drawable.ic_access_alarm_24dp, sut.icon())
+ assertThat(sut.icon()).isEqualTo(app.aaps.core.main.R.drawable.ic_access_alarm_24dp)
}
@Test fun doActionTest() {
sut.text = InputString("Asd")
sut.doAction(object : Callback() {
override fun run() {
- Assertions.assertTrue(result.success)
+ assertThat(result.success).isTrue()
}
})
}
@Test fun hasDialogTest() {
- Assertions.assertTrue(sut.hasDialog())
+ assertThat(sut.hasDialog()).isTrue()
}
@Test fun toJSONTest() {
sut.text = InputString("Asd")
- Assertions.assertEquals("{\"data\":{\"text\":\"Asd\"},\"type\":\"ActionAlarm\"}", sut.toJSON())
+ JSONAssert.assertEquals("""{"data":{"text":"Asd"},"type":"ActionAlarm"}""", sut.toJSON(), true)
}
@Test fun fromJSONTest() {
sut.text = InputString("Asd")
- sut.fromJSON("{\"text\":\"Asd\"}")
- Assertions.assertEquals("Asd", sut.text.value)
+ sut.fromJSON("""{"text":"Asd"}""")
+ assertThat(sut.text.value).isEqualTo("Asd")
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionCarePortalEventTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionCarePortalEventTest.kt
index a17c89966b..da5dcfda01 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionCarePortalEventTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionCarePortalEventTest.kt
@@ -8,11 +8,12 @@ import app.aaps.plugins.automation.elements.InputCarePortalMenu
import app.aaps.plugins.automation.elements.InputDuration
import app.aaps.plugins.automation.elements.InputString
import io.reactivex.rxjava3.core.Single
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.ArgumentMatchers
import org.mockito.Mockito.`when`
+import org.skyscreamer.jsonassert.JSONAssert
class ActionCarePortalEventTest : ActionsTestBase() {
@@ -35,41 +36,42 @@ class ActionCarePortalEventTest : ActionsTestBase() {
}
@Test fun friendlyNameTest() {
- Assertions.assertEquals(app.aaps.core.ui.R.string.careportal, sut.friendlyName())
+ assertThat(sut.friendlyName()).isEqualTo(app.aaps.core.ui.R.string.careportal)
}
@Test fun shortDescriptionTest() {
- Assertions.assertEquals("Note : Asd", sut.shortDescription())
+ assertThat(sut.shortDescription()).isEqualTo("Note : Asd")
}
@Test fun iconTest() {
- Assertions.assertEquals(app.aaps.core.main.R.drawable.ic_cp_note, sut.icon())
+ assertThat(sut.icon()).isEqualTo(app.aaps.core.main.R.drawable.ic_cp_note)
}
@Test fun doActionTest() {
sut.doAction(object : Callback() {
override fun run() {
- Assertions.assertTrue(result.success)
+ assertThat(result.success).isTrue()
}
})
}
@Test fun hasDialogTest() {
- Assertions.assertTrue(sut.hasDialog())
+ assertThat(sut.hasDialog()).isTrue()
}
@Test fun toJSONTest() {
- Assertions.assertEquals(
- "{\"data\":{\"note\":\"Asd\",\"cpEvent\":\"NOTE\",\"durationInMinutes\":5},\"type\":\"ActionCarePortalEvent\"}",
- sut.toJSON()
+ JSONAssert.assertEquals(
+ """{"data":{"note":"Asd","cpEvent":"NOTE","durationInMinutes":5},"type":"ActionCarePortalEvent"}""",
+ sut.toJSON(),
+ true,
)
}
@Test fun fromJSONTest() {
sut.note = InputString("Asd")
- sut.fromJSON("{\"note\":\"Asd\",\"cpEvent\":\"NOTE\",\"durationInMinutes\":5}")
- Assertions.assertEquals("Asd", sut.note.value)
- Assertions.assertEquals(5, sut.duration.value)
- Assertions.assertEquals(InputCarePortalMenu.EventType.NOTE, sut.cpEvent.value)
+ sut.fromJSON("""{"note":"Asd","cpEvent":"NOTE","durationInMinutes":5}""")
+ assertThat(sut.note.value).isEqualTo("Asd")
+ assertThat(sut.duration.value).isEqualTo(5)
+ assertThat(sut.cpEvent.value).isEqualTo(InputCarePortalMenu.EventType.NOTE)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionDummyTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionDummyTest.kt
index e551d18003..c35544c4b6 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionDummyTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionDummyTest.kt
@@ -1,20 +1,20 @@
package app.aaps.plugins.automation.actions
+import kotlin.test.assertIs
import org.json.JSONObject
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
class ActionDummyTest : ActionsTestBase() {
@Test
fun instantiateTest() {
- var action: Action? = ActionDummy(injector).instantiate(JSONObject("{\"type\":\"info.nightscout.androidaps.plugins.general.automation.actions.ActionDummy\"}"))
- Assertions.assertTrue(action is ActionDummy)
+ var action: Action? = ActionDummy(injector).instantiate(JSONObject("""{"type":"info.nightscout.androidaps.plugins.general.automation.actions.ActionDummy"}"""))
+ assertIs(action)
- action = ActionDummy(injector).instantiate(JSONObject("{\"type\":\"app.aaps.plugins.automation.actions.ActionDummy\"}"))
- Assertions.assertTrue(action is ActionDummy)
+ action = ActionDummy(injector).instantiate(JSONObject("""{"type":"app.aaps.plugins.automation.actions.ActionDummy"}"""))
+ assertIs(action)
- action = ActionDummy(injector).instantiate(JSONObject("{\"type\":\"ActionDummy\"}"))
- Assertions.assertTrue(action is ActionDummy)
+ action = ActionDummy(injector).instantiate(JSONObject("""{"type":"ActionDummy"}"""))
+ assertIs(action)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionLoopDisableTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionLoopDisableTest.kt
index 2916e31936..2167e66d0a 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionLoopDisableTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionLoopDisableTest.kt
@@ -3,7 +3,7 @@ package app.aaps.plugins.automation.actions
import app.aaps.core.interfaces.plugin.PluginType
import app.aaps.core.interfaces.queue.Callback
import app.aaps.plugins.automation.R
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.ArgumentMatchers.eq
@@ -27,17 +27,17 @@ class ActionLoopDisableTest : ActionsTestBase() {
@Test
fun friendlyNameTest() {
- Assertions.assertEquals(app.aaps.core.ui.R.string.disableloop, sut.friendlyName())
+ assertThat(sut.friendlyName()).isEqualTo(app.aaps.core.ui.R.string.disableloop)
}
@Test
fun shortDescriptionTest() {
- Assertions.assertEquals("Disable loop", sut.shortDescription())
+ assertThat(sut.shortDescription()).isEqualTo("Disable loop")
}
@Test
fun iconTest() {
- Assertions.assertEquals(R.drawable.ic_stop_24dp, sut.icon())
+ assertThat(sut.icon()).isEqualTo(R.drawable.ic_stop_24dp)
}
@Test
@@ -60,4 +60,4 @@ class ActionLoopDisableTest : ActionsTestBase() {
Mockito.verify(configBuilder, Mockito.times(1)).storeSettings("ActionLoopDisable")
Mockito.verify(commandQueue, Mockito.times(1)).cancelTempBasal(eq(true), anyObject())
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionLoopEnableTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionLoopEnableTest.kt
index 879e1b1ac3..9db6493dff 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionLoopEnableTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionLoopEnableTest.kt
@@ -3,7 +3,7 @@ package app.aaps.plugins.automation.actions
import app.aaps.core.interfaces.plugin.PluginType
import app.aaps.core.interfaces.queue.Callback
import app.aaps.plugins.automation.R
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mockito
@@ -24,15 +24,15 @@ class ActionLoopEnableTest : ActionsTestBase() {
}
@Test fun friendlyNameTest() {
- Assertions.assertEquals(app.aaps.core.ui.R.string.enableloop, sut.friendlyName())
+ assertThat(sut.friendlyName()).isEqualTo(app.aaps.core.ui.R.string.enableloop)
}
@Test fun shortDescriptionTest() {
- Assertions.assertEquals("Enable loop", sut.shortDescription())
+ assertThat(sut.shortDescription()).isEqualTo("Enable loop")
}
@Test fun iconTest() {
- Assertions.assertEquals(R.drawable.ic_play_circle_outline_24dp, sut.icon())
+ assertThat(sut.icon()).isEqualTo(R.drawable.ic_play_circle_outline_24dp)
}
@Test fun doActionTest() {
@@ -52,4 +52,4 @@ class ActionLoopEnableTest : ActionsTestBase() {
Mockito.verify(loopPlugin, Mockito.times(1)).setPluginEnabled(PluginType.LOOP, true)
Mockito.verify(configBuilder, Mockito.times(1)).storeSettings("ActionLoopEnable")
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionLoopResumeTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionLoopResumeTest.kt
index c022e95fcc..ca1e5eee78 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionLoopResumeTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionLoopResumeTest.kt
@@ -6,7 +6,7 @@ import app.aaps.database.impl.transactions.CancelCurrentOfflineEventIfAnyTransac
import app.aaps.database.impl.transactions.Transaction
import app.aaps.plugins.automation.R
import io.reactivex.rxjava3.core.Single
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mockito.`when`
@@ -25,15 +25,15 @@ class ActionLoopResumeTest : ActionsTestBase() {
}
@Test fun friendlyNameTest() {
- Assertions.assertEquals(app.aaps.core.ui.R.string.resumeloop, sut.friendlyName())
+ assertThat(sut.friendlyName()).isEqualTo(app.aaps.core.ui.R.string.resumeloop)
}
@Test fun shortDescriptionTest() {
- Assertions.assertEquals("Resume loop", sut.shortDescription())
+ assertThat(sut.shortDescription()).isEqualTo("Resume loop")
}
@Test fun iconTest() {
- Assertions.assertEquals(R.drawable.ic_replay_24dp, sut.icon())
+ assertThat(sut.icon()).isEqualTo(R.drawable.ic_replay_24dp)
}
@Test fun doActionTest() {
@@ -64,4 +64,4 @@ class ActionLoopResumeTest : ActionsTestBase() {
})
//Mockito.verify(loopPlugin, Mockito.times(1)).suspendTo(0)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionLoopSuspendTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionLoopSuspendTest.kt
index e0f43e9f0c..bf2529ec8b 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionLoopSuspendTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionLoopSuspendTest.kt
@@ -3,7 +3,7 @@ package app.aaps.plugins.automation.actions
import app.aaps.core.interfaces.queue.Callback
import app.aaps.plugins.automation.R
import app.aaps.plugins.automation.elements.InputDuration
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mockito
@@ -24,16 +24,16 @@ class ActionLoopSuspendTest : ActionsTestBase() {
}
@Test fun friendlyNameTest() {
- Assertions.assertEquals(app.aaps.core.ui.R.string.suspendloop, sut.friendlyName())
+ assertThat(sut.friendlyName()).isEqualTo(app.aaps.core.ui.R.string.suspendloop)
}
@Test fun shortDescriptionTest() {
sut.minutes = InputDuration(30, InputDuration.TimeUnit.MINUTES)
- Assertions.assertEquals("Suspend loop for 30 min", sut.shortDescription())
+ assertThat(sut.shortDescription()).isEqualTo("Suspend loop for 30 min")
}
@Test fun iconTest() {
- Assertions.assertEquals(R.drawable.ic_pause_circle_outline_24dp, sut.icon())
+ assertThat(sut.icon()).isEqualTo(R.drawable.ic_pause_circle_outline_24dp)
}
@Test fun doActionTest() {
@@ -57,11 +57,11 @@ class ActionLoopSuspendTest : ActionsTestBase() {
a.minutes = InputDuration(20, InputDuration.TimeUnit.MINUTES)
val b = ActionLoopSuspend(injector)
b.apply(a)
- Assertions.assertEquals(20, b.minutes.getMinutes().toLong())
+ assertThat(b.minutes.getMinutes().toLong()).isEqualTo(20)
}
@Test fun hasDialogTest() {
val a = ActionLoopSuspend(injector)
- Assertions.assertTrue(a.hasDialog())
+ assertThat(a.hasDialog()).isTrue()
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionNotificationTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionNotificationTest.kt
index 79f6697abf..c143ca279a 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionNotificationTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionNotificationTest.kt
@@ -14,13 +14,14 @@ import app.aaps.shared.tests.TestBase
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import io.reactivex.rxjava3.core.Completable
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.ArgumentMatchers
import org.mockito.Mock
import org.mockito.Mockito
import org.mockito.Mockito.`when`
+import org.skyscreamer.jsonassert.JSONAssert
class ActionNotificationTest : TestBase() {
@@ -60,22 +61,22 @@ class ActionNotificationTest : TestBase() {
}
@Test fun friendlyNameTest() {
- Assertions.assertEquals(app.aaps.core.ui.R.string.notification, sut.friendlyName())
+ assertThat(sut.friendlyName()).isEqualTo(app.aaps.core.ui.R.string.notification)
}
@Test fun shortDescriptionTest() {
sut.text = InputString("Asd")
- Assertions.assertEquals("Notification: %s", sut.shortDescription())
+ assertThat(sut.shortDescription()).isEqualTo("Notification: %s")
}
@Test fun iconTest() {
- Assertions.assertEquals(R.drawable.ic_notifications, sut.icon())
+ assertThat(sut.icon()).isEqualTo(R.drawable.ic_notifications)
}
@Test fun doActionTest() {
sut.doAction(object : Callback() {
override fun run() {
- Assertions.assertTrue(result.success)
+ assertThat(result.success).isTrue()
}
})
Mockito.verify(rxBusMocked, Mockito.times(2)).send(anyObject())
@@ -83,20 +84,21 @@ class ActionNotificationTest : TestBase() {
}
@Test fun hasDialogTest() {
- Assertions.assertTrue(sut.hasDialog())
+ assertThat(sut.hasDialog())
}
@Test fun toJSONTest() {
sut.text = InputString("Asd")
- Assertions.assertEquals(
- "{\"data\":{\"text\":\"Asd\"},\"type\":\"ActionNotification\"}",
- sut.toJSON()
+ JSONAssert.assertEquals(
+ """{"data":{"text":"Asd"},"type":"ActionNotification"}""",
+ sut.toJSON(),
+ true,
)
}
@Test fun fromJSONTest() {
sut.text = InputString("Asd")
- sut.fromJSON("{\"text\":\"Asd\"}")
- Assertions.assertEquals("Asd", sut.text.value)
+ sut.fromJSON("""{"text":"Asd"}""")
+ assertThat(sut.text.value).isEqualTo("Asd")
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionProfileSwitchPercentTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionProfileSwitchPercentTest.kt
index d40c9d784b..655a45cf5b 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionProfileSwitchPercentTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionProfileSwitchPercentTest.kt
@@ -4,11 +4,12 @@ import app.aaps.core.interfaces.queue.Callback
import app.aaps.plugins.automation.R
import app.aaps.plugins.automation.elements.InputDuration
import app.aaps.plugins.automation.elements.InputPercent
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mockito
import org.mockito.Mockito.`when`
+import org.skyscreamer.jsonassert.JSONAssert
class ActionProfileSwitchPercentTest : ActionsTestBase() {
@@ -24,17 +25,17 @@ class ActionProfileSwitchPercentTest : ActionsTestBase() {
}
@Test fun friendlyNameTest() {
- Assertions.assertEquals(R.string.profilepercentage, sut.friendlyName())
+ assertThat(sut.friendlyName()).isEqualTo(R.string.profilepercentage)
}
@Test fun shortDescriptionTest() {
sut.pct = InputPercent(100.0)
sut.duration = InputDuration(30, InputDuration.TimeUnit.MINUTES)
- Assertions.assertEquals("Start profile 100% for 30 min", sut.shortDescription())
+ assertThat(sut.shortDescription()).isEqualTo("Start profile 100% for 30 min")
}
@Test fun iconTest() {
- Assertions.assertEquals(app.aaps.core.ui.R.drawable.ic_actions_profileswitch, sut.icon())
+ assertThat(sut.icon()).isEqualTo(app.aaps.core.ui.R.drawable.ic_actions_profileswitch)
}
@Test fun doActionTest() {
@@ -43,25 +44,25 @@ class ActionProfileSwitchPercentTest : ActionsTestBase() {
sut.duration = InputDuration(30, InputDuration.TimeUnit.MINUTES)
sut.doAction(object : Callback() {
override fun run() {
- Assertions.assertTrue(result.success)
+ assertThat(result.success).isTrue()
}
})
Mockito.verify(profileFunction, Mockito.times(1)).createProfileSwitch(30, 110, 0)
}
@Test fun hasDialogTest() {
- Assertions.assertTrue(sut.hasDialog())
+ assertThat(sut.hasDialog()).isTrue()
}
@Test fun toJSONTest() {
sut.pct = InputPercent(100.0)
sut.duration = InputDuration(30, InputDuration.TimeUnit.MINUTES)
- Assertions.assertEquals("{\"data\":{\"percentage\":100,\"durationInMinutes\":30},\"type\":\"ActionProfileSwitchPercent\"}", sut.toJSON())
+ JSONAssert.assertEquals("""{"data":{"percentage":100,"durationInMinutes":30},"type":"ActionProfileSwitchPercent"}""", sut.toJSON(), true)
}
@Test fun fromJSONTest() {
- sut.fromJSON("{\"percentage\":100,\"durationInMinutes\":30}")
- Assertions.assertEquals(100.0, sut.pct.value, 0.001)
- Assertions.assertEquals(30.0, sut.duration.getMinutes().toDouble(), 0.001)
+ sut.fromJSON("""{"percentage":100,"durationInMinutes":30}""")
+ assertThat(sut.pct.value).isWithin(0.001).of(100.0)
+ assertThat(sut.duration.getMinutes().toDouble()).isWithin(0.001).of(30.0)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionProfileSwitchTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionProfileSwitchTest.kt
index b0fd27aefe..bb1a1980c1 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionProfileSwitchTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionProfileSwitchTest.kt
@@ -3,7 +3,7 @@ package app.aaps.plugins.automation.actions
import app.aaps.core.interfaces.queue.Callback
import app.aaps.plugins.automation.R
import app.aaps.plugins.automation.elements.InputProfileName
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.ArgumentMatchers.anyLong
@@ -11,13 +11,14 @@ import org.mockito.Mockito
import org.mockito.Mockito.anyInt
import org.mockito.Mockito.anyString
import org.mockito.Mockito.`when`
+import org.skyscreamer.jsonassert.JSONAssert
+
+private const val STRING_JSON = """{"data":{"profileToSwitchTo":"Test"},"type":"ActionProfileSwitch"}"""
class ActionProfileSwitchTest : ActionsTestBase() {
private lateinit var sut: ActionProfileSwitch
- private val stringJson = "{\"data\":{\"profileToSwitchTo\":\"Test\"},\"type\":\"ActionProfileSwitch\"}"
-
@BeforeEach fun setUp() {
`when`(rh.gs(R.string.profilename)).thenReturn("Change profile to")
`when`(rh.gs(R.string.changengetoprofilename)).thenReturn("Change profile to %s")
@@ -30,11 +31,11 @@ class ActionProfileSwitchTest : ActionsTestBase() {
}
@Test fun friendlyName() {
- Assertions.assertEquals(R.string.profilename, sut.friendlyName())
+ assertThat(sut.friendlyName()).isEqualTo(R.string.profilename)
}
@Test fun shortDescriptionTest() {
- Assertions.assertEquals("Change profile to ", sut.shortDescription())
+ assertThat(sut.shortDescription()).isEqualTo("Change profile to ")
}
@Test fun doAction() {
@@ -43,7 +44,7 @@ class ActionProfileSwitchTest : ActionsTestBase() {
sut.inputProfileName = InputProfileName(rh, activePlugin, "")
sut.doAction(object : Callback() {
override fun run() {
- Assertions.assertFalse(result.success)
+ assertThat(result.success).isFalse()
}
})
@@ -52,7 +53,7 @@ class ActionProfileSwitchTest : ActionsTestBase() {
sut.inputProfileName = InputProfileName(rh, activePlugin, "someProfile")
sut.doAction(object : Callback() {
override fun run() {
- Assertions.assertFalse(result.success)
+ assertThat(result.success).isFalse()
}
})
@@ -62,8 +63,8 @@ class ActionProfileSwitchTest : ActionsTestBase() {
sut.inputProfileName = InputProfileName(rh, activePlugin, "Test")
sut.doAction(object : Callback() {
override fun run() {
- Assertions.assertTrue(result.success)
- Assertions.assertEquals("Already set", result.comment)
+ assertThat(result.success).isTrue()
+ assertThat(result.comment).isEqualTo("Already set")
}
})
@@ -72,8 +73,8 @@ class ActionProfileSwitchTest : ActionsTestBase() {
sut.inputProfileName = InputProfileName(rh, activePlugin, "Test")
sut.doAction(object : Callback() {
override fun run() {
- Assertions.assertFalse(result.success)
- Assertions.assertEquals("not exists", result.comment)
+ assertThat(result.success).isFalse()
+ assertThat(result.comment).isEqualTo("not exists")
}
})
@@ -83,29 +84,28 @@ class ActionProfileSwitchTest : ActionsTestBase() {
sut.inputProfileName = InputProfileName(rh, activePlugin, TESTPROFILENAME)
sut.doAction(object : Callback() {
override fun run() {
- Assertions.assertTrue(result.success)
- Assertions.assertEquals("OK", result.comment)
+ assertThat(result.success).isTrue()
+ assertThat(result.comment).isEqualTo("OK")
}
})
Mockito.verify(profileFunction, Mockito.times(1)).createProfileSwitch(anyObject(), anyString(), anyInt(), anyInt(), anyInt(), anyLong())
}
@Test fun hasDialogTest() {
- Assertions.assertTrue(sut.hasDialog())
+ assertThat(sut.hasDialog()).isTrue()
}
@Test fun toJSONTest() {
sut.inputProfileName = InputProfileName(rh, activePlugin, "Test")
- Assertions.assertEquals(stringJson, sut.toJSON())
+ JSONAssert.assertEquals(STRING_JSON, sut.toJSON(), true)
}
@Test fun fromJSONTest() {
- val data = "{\"profileToSwitchTo\":\"Test\"}"
- sut.fromJSON(data)
- Assertions.assertEquals("Test", sut.inputProfileName.value)
+ sut.fromJSON("""{"profileToSwitchTo":"Test"}""")
+ assertThat(sut.inputProfileName.value).isEqualTo("Test")
}
@Test fun iconTest() {
- Assertions.assertEquals(app.aaps.core.ui.R.drawable.ic_actions_profileswitch, sut.icon())
+ assertThat(sut.icon()).isEqualTo(app.aaps.core.ui.R.drawable.ic_actions_profileswitch)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionSendSMSTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionSendSMSTest.kt
index e75812ccbb..5b115116bc 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionSendSMSTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionSendSMSTest.kt
@@ -3,11 +3,12 @@ package app.aaps.plugins.automation.actions
import app.aaps.core.interfaces.queue.Callback
import app.aaps.plugins.automation.R
import app.aaps.plugins.automation.elements.InputString
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.ArgumentMatchers.anyString
import org.mockito.Mockito.`when`
+import org.skyscreamer.jsonassert.JSONAssert
class ActionSendSMSTest : ActionsTestBase() {
@@ -23,15 +24,15 @@ class ActionSendSMSTest : ActionsTestBase() {
}
@Test fun friendlyNameTest() {
- Assertions.assertEquals(R.string.sendsmsactiondescription, sut.friendlyName())
+ assertThat(sut.friendlyName()).isEqualTo(R.string.sendsmsactiondescription)
}
@Test fun shortDescriptionTest() {
- Assertions.assertEquals("Send SMS: ", sut.shortDescription())
+ assertThat(sut.shortDescription()).isEqualTo("Send SMS: ")
}
@Test fun iconTest() {
- Assertions.assertEquals(R.drawable.ic_notifications, sut.icon())
+ assertThat(sut.icon()).isEqualTo(R.drawable.ic_notifications)
}
@Test fun doActionTest() {
@@ -39,22 +40,22 @@ class ActionSendSMSTest : ActionsTestBase() {
sut.text = InputString("Asd")
sut.doAction(object : Callback() {
override fun run() {
- Assertions.assertTrue(result.success)
+ assertThat(result.success).isTrue()
}
})
}
@Test fun hasDialogTest() {
- Assertions.assertTrue(sut.hasDialog())
+ assertThat(sut.hasDialog()).isTrue()
}
@Test fun toJSONTest() {
sut.text = InputString("Asd")
- Assertions.assertEquals("{\"data\":{\"text\":\"Asd\"},\"type\":\"ActionSendSMS\"}", sut.toJSON())
+ JSONAssert.assertEquals("""{"data":{"text":"Asd"},"type":"ActionSendSMS"}""", sut.toJSON(), true)
}
@Test fun fromJSONTest() {
- sut.fromJSON("{\"text\":\"Asd\"}")
- Assertions.assertEquals("Asd", sut.text.value)
+ sut.fromJSON("""{"text":"Asd"}""")
+ assertThat(sut.text.value).isEqualTo("Asd")
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionStartTempTargetTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionStartTempTargetTest.kt
index 0acb80f798..28d98cc37d 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionStartTempTargetTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionStartTempTargetTest.kt
@@ -9,11 +9,12 @@ import app.aaps.plugins.automation.R
import app.aaps.plugins.automation.elements.InputDuration
import app.aaps.plugins.automation.elements.InputTempTarget
import io.reactivex.rxjava3.core.Single
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mockito
import org.mockito.Mockito.`when`
+import org.skyscreamer.jsonassert.JSONAssert
class ActionStartTempTargetTest : ActionsTestBase() {
@@ -27,18 +28,18 @@ class ActionStartTempTargetTest : ActionsTestBase() {
}
@Test fun friendlyNameTest() {
- Assertions.assertEquals(R.string.starttemptarget, sut.friendlyName())
+ assertThat(sut.friendlyName()).isEqualTo(R.string.starttemptarget)
}
@Test fun shortDescriptionTest() {
sut.value = InputTempTarget(profileFunction)
sut.value.value = 100.0
sut.duration = InputDuration(30, InputDuration.TimeUnit.MINUTES)
- Assertions.assertEquals("Start temp target: 100mg/dl@null(Automation)", sut.shortDescription())
+ assertThat(sut.shortDescription()).isEqualTo("Start temp target: 100mg/dl@null(Automation)")
}
@Test fun iconTest() {
- Assertions.assertEquals(app.aaps.core.main.R.drawable.ic_temptarget_high, sut.icon())
+ assertThat(sut.icon()).isEqualTo(app.aaps.core.main.R.drawable.ic_temptarget_high)
}
@Test fun doActionTest() {
@@ -78,27 +79,27 @@ class ActionStartTempTargetTest : ActionsTestBase() {
sut.doAction(object : Callback() {
override fun run() {
- Assertions.assertTrue(result.success)
+ assertThat(result.success).isTrue()
}
})
Mockito.verify(repository, Mockito.times(1)).runTransactionForResult(anyObject>())
}
@Test fun hasDialogTest() {
- Assertions.assertTrue(sut.hasDialog())
+ assertThat(sut.hasDialog()).isTrue()
}
@Test fun toJSONTest() {
sut.value = InputTempTarget(profileFunction)
sut.value.value = 100.0
sut.duration = InputDuration(30, InputDuration.TimeUnit.MINUTES)
- Assertions.assertEquals("{\"data\":{\"durationInMinutes\":30,\"units\":\"mg/dl\",\"value\":100},\"type\":\"ActionStartTempTarget\"}", sut.toJSON())
+ JSONAssert.assertEquals("""{"data":{"durationInMinutes":30,"units":"mg/dl","value":100},"type":"ActionStartTempTarget"}""", sut.toJSON(), true)
}
@Test fun fromJSONTest() {
- sut.fromJSON("{\"value\":100,\"durationInMinutes\":30,\"units\":\"mg/dl\"}")
- Assertions.assertEquals(GlucoseUnit.MGDL, sut.value.units)
- Assertions.assertEquals(100.0, sut.value.value, 0.001)
- Assertions.assertEquals(30.0, sut.duration.getMinutes().toDouble(), 0.001)
+ sut.fromJSON("""{"value":100,"durationInMinutes":30,"units":"mg/dl"}""")
+ assertThat(sut.value.units).isEqualTo(GlucoseUnit.MGDL)
+ assertThat(sut.value.value).isWithin(0.001).of(100.0)
+ assertThat(sut.duration.getMinutes().toDouble()).isWithin(0.001).of(30.0)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionStopProcessingTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionStopProcessingTest.kt
index 0f35c81370..d9d84d1fdf 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionStopProcessingTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionStopProcessingTest.kt
@@ -2,7 +2,7 @@ package app.aaps.plugins.automation.actions
import app.aaps.core.interfaces.queue.Callback
import app.aaps.plugins.automation.R
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mockito.`when`
@@ -20,25 +20,25 @@ class ActionStopProcessingTest : ActionsTestBase() {
@Test
fun friendlyNameTest() {
- Assertions.assertEquals(R.string.stop_processing, sut.friendlyName())
+ assertThat(sut.friendlyName()).isEqualTo(R.string.stop_processing)
}
@Test
fun shortDescriptionTest() {
- Assertions.assertEquals("Stop processing", sut.shortDescription())
+ assertThat(sut.shortDescription()).isEqualTo("Stop processing")
}
@Test
fun iconTest() {
- Assertions.assertEquals(R.drawable.ic_stop_24dp, sut.icon())
+ assertThat(sut.icon()).isEqualTo(R.drawable.ic_stop_24dp)
}
@Test
fun doActionTest() {
sut.doAction(object : Callback() {
override fun run() {
- Assertions.assertTrue(result.success)
+ assertThat(result.success).isTrue()
}
})
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionStopTempTargetTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionStopTempTargetTest.kt
index 6b9f69ada8..c67c8177f7 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionStopTempTargetTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/actions/ActionStopTempTargetTest.kt
@@ -6,11 +6,12 @@ import app.aaps.database.impl.transactions.CancelCurrentTemporaryTargetIfAnyTran
import app.aaps.database.impl.transactions.Transaction
import app.aaps.plugins.automation.R
import io.reactivex.rxjava3.core.Single
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mockito
import org.mockito.Mockito.`when`
+import org.skyscreamer.jsonassert.JSONAssert
class ActionStopTempTargetTest : ActionsTestBase() {
@@ -24,15 +25,15 @@ class ActionStopTempTargetTest : ActionsTestBase() {
}
@Test fun friendlyNameTest() {
- Assertions.assertEquals(app.aaps.core.ui.R.string.stoptemptarget, sut.friendlyName())
+ assertThat(sut.friendlyName()).isEqualTo(app.aaps.core.ui.R.string.stoptemptarget)
}
@Test fun shortDescriptionTest() {
- Assertions.assertEquals("Stop temp target", sut.shortDescription())
+ assertThat(sut.shortDescription()).isEqualTo("Stop temp target")
}
@Test fun iconTest() {
- Assertions.assertEquals(R.drawable.ic_stop_24dp, sut.icon())
+ assertThat(sut.icon()).isEqualTo(R.drawable.ic_stop_24dp)
}
@Test fun doActionTest() {
@@ -52,22 +53,22 @@ class ActionStopTempTargetTest : ActionsTestBase() {
sut.doAction(object : Callback() {
override fun run() {
- Assertions.assertTrue(result.success)
+ assertThat(result.success).isTrue()
}
})
Mockito.verify(repository, Mockito.times(1)).runTransactionForResult((anyObject>()))
}
@Test fun hasDialogTest() {
- Assertions.assertFalse(sut.hasDialog())
+ assertThat(sut.hasDialog()).isFalse()
}
@Test fun toJSONTest() {
- Assertions.assertEquals("{\"type\":\"ActionStopTempTarget\"}", sut.toJSON())
+ JSONAssert.assertEquals("""{"type":"ActionStopTempTarget"}""", sut.toJSON(), true)
}
@Test fun fromJSONTest() {
- sut.fromJSON("{\"reason\":\"Test\"}")
- Assertions.assertNotNull(sut)
+ sut.fromJSON("""{"reason":"Test"}""")
+ assertThat(sut).isNotNull()
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/ComparatorConnectTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/ComparatorConnectTest.kt
index 3c833198d0..b4b8da7f7d 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/ComparatorConnectTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/ComparatorConnectTest.kt
@@ -1,18 +1,18 @@
package app.aaps.plugins.automation.elements
import app.aaps.plugins.automation.triggers.TriggerTestBase
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.Test
class ComparatorConnectTest : TriggerTestBase() {
@Test fun labelsTest() {
- Assertions.assertEquals(2, ComparatorConnect.Compare.labels(rh).size)
+ assertThat(ComparatorConnect.Compare.labels(rh)).hasSize(2)
}
@Test fun setValueTest() {
val c = ComparatorConnect(rh)
c.value = ComparatorConnect.Compare.ON_DISCONNECT
- Assertions.assertEquals(ComparatorConnect.Compare.ON_DISCONNECT, c.value)
+ assertThat(c.value).isEqualTo(ComparatorConnect.Compare.ON_DISCONNECT)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/ComparatorExistsTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/ComparatorExistsTest.kt
index 7f456c514d..d2a7021f05 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/ComparatorExistsTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/ComparatorExistsTest.kt
@@ -1,18 +1,18 @@
package app.aaps.plugins.automation.elements
import app.aaps.plugins.automation.triggers.TriggerTestBase
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.Test
class ComparatorExistsTest : TriggerTestBase() {
@Test fun labelsTest() {
- Assertions.assertEquals(2, ComparatorExists.Compare.labels(rh).size)
+ assertThat(ComparatorExists.Compare.labels(rh)).hasSize(2)
}
@Test fun setValueTest() {
val c = ComparatorExists(rh)
c.value = ComparatorExists.Compare.NOT_EXISTS
- Assertions.assertEquals(ComparatorExists.Compare.NOT_EXISTS, c.value)
+ assertThat(c.value).isEqualTo(ComparatorExists.Compare.NOT_EXISTS)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/ComparatorTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/ComparatorTest.kt
index 80f31ab078..6363e834f3 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/ComparatorTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/ComparatorTest.kt
@@ -1,35 +1,35 @@
package app.aaps.plugins.automation.elements
import app.aaps.plugins.automation.triggers.TriggerTestBase
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.Test
class ComparatorTest : TriggerTestBase() {
@Test
fun checkTest() {
- Assertions.assertTrue(Comparator.Compare.IS_EQUAL.check(1, 1))
- Assertions.assertTrue(Comparator.Compare.IS_LESSER.check(1, 2))
- Assertions.assertTrue(Comparator.Compare.IS_EQUAL_OR_LESSER.check(1, 2))
- Assertions.assertTrue(Comparator.Compare.IS_EQUAL_OR_LESSER.check(2, 2))
- Assertions.assertTrue(Comparator.Compare.IS_GREATER.check(2, 1))
- Assertions.assertTrue(Comparator.Compare.IS_EQUAL_OR_GREATER.check(2, 1))
- Assertions.assertTrue(Comparator.Compare.IS_EQUAL_OR_GREATER.check(2, 2))
- Assertions.assertFalse(Comparator.Compare.IS_LESSER.check(2, 1))
- Assertions.assertFalse(Comparator.Compare.IS_EQUAL_OR_LESSER.check(2, 1))
- Assertions.assertFalse(Comparator.Compare.IS_GREATER.check(1, 2))
- Assertions.assertFalse(Comparator.Compare.IS_EQUAL_OR_GREATER.check(1, 2))
-// Assertions.assertTrue(Comparator.Compare.IS_NOT_AVAILABLE.check(1, null))
+ assertThat(Comparator.Compare.IS_EQUAL.check(1, 1)).isTrue()
+ assertThat(Comparator.Compare.IS_LESSER.check(1, 2)).isTrue()
+ assertThat(Comparator.Compare.IS_EQUAL_OR_LESSER.check(1, 2)).isTrue()
+ assertThat(Comparator.Compare.IS_EQUAL_OR_LESSER.check(2, 2)).isTrue()
+ assertThat(Comparator.Compare.IS_GREATER.check(2, 1)).isTrue()
+ assertThat(Comparator.Compare.IS_EQUAL_OR_GREATER.check(2, 1)).isTrue()
+ assertThat(Comparator.Compare.IS_EQUAL_OR_GREATER.check(2, 2)).isTrue()
+ assertThat(Comparator.Compare.IS_LESSER.check(2, 1)).isFalse()
+ assertThat(Comparator.Compare.IS_EQUAL_OR_LESSER.check(2, 1)).isFalse()
+ assertThat(Comparator.Compare.IS_GREATER.check(1, 2)).isFalse()
+ assertThat(Comparator.Compare.IS_EQUAL_OR_GREATER.check(1, 2)).isFalse()
+// assertThat(Comparator.Compare.IS_NOT_AVAILABLE.check(1, null)).isTrue()
}
@Test
fun labelsTest() {
- Assertions.assertEquals(6, Comparator.Compare.labels(rh).size)
+ assertThat(Comparator.Compare.labels(rh)).hasSize(6)
}
@Test
fun setValueTest() {
val c: Comparator = Comparator(rh).setValue(Comparator.Compare.IS_EQUAL_OR_GREATER)
- Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_GREATER, c.value)
+ assertThat(c.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_GREATER)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputBgTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputBgTest.kt
index 7ac891bc13..49af000a2d 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputBgTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputBgTest.kt
@@ -2,7 +2,7 @@ package app.aaps.plugins.automation.elements
import app.aaps.core.interfaces.db.GlucoseUnit
import app.aaps.plugins.automation.triggers.TriggerTestBase
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mockito.`when`
@@ -12,16 +12,16 @@ class InputBgTest : TriggerTestBase() {
@Test
fun setValueTest() {
var i: InputBg = InputBg(profileFunction).setUnits(GlucoseUnit.MMOL).setValue(5.0)
- Assertions.assertEquals(5.0, i.value, 0.01)
- Assertions.assertEquals(InputBg.MMOL_MIN, i.minValue, 0.01)
+ assertThat(i.value).isWithin(0.01).of(5.0)
+ assertThat(i.minValue).isWithin(0.01).of(InputBg.MMOL_MIN)
i = InputBg(profileFunction).setValue(100.0).setUnits(GlucoseUnit.MGDL)
- Assertions.assertEquals(100.0, i.value, 0.01)
- Assertions.assertEquals(InputBg.MGDL_MIN, i.minValue, 0.01)
- Assertions.assertEquals(GlucoseUnit.MGDL, i.units)
+ assertThat(i.value).isWithin(0.01).of(100.0)
+ assertThat(i.minValue).isWithin(0.01).of(InputBg.MGDL_MIN)
+ assertThat(i.units).isEqualTo(GlucoseUnit.MGDL)
}
@BeforeEach
fun prepare() {
`when`(profileFunction.getUnits()).thenReturn(GlucoseUnit.MGDL)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputCarePortalEventTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputCarePortalEventTest.kt
index e380c24420..1d875a2cd2 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputCarePortalEventTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputCarePortalEventTest.kt
@@ -1,19 +1,19 @@
package app.aaps.plugins.automation.elements
import app.aaps.plugins.automation.triggers.TriggerTestBase
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.Test
class InputCarePortalEventTest : TriggerTestBase() {
@Test
fun labelsTest() {
- Assertions.assertEquals(4, InputCarePortalMenu.EventType.labels(rh).size)
+ assertThat(InputCarePortalMenu.EventType.labels(rh)).hasSize(4)
}
@Test
fun setValueTest() {
val cp = InputCarePortalMenu(rh, InputCarePortalMenu.EventType.EXERCISE)
- Assertions.assertEquals(InputCarePortalMenu.EventType.EXERCISE, cp.value)
+ assertThat(cp.value).isEqualTo(InputCarePortalMenu.EventType.EXERCISE)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputDurationTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputDurationTest.kt
index 3e58875146..08e5492b29 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputDurationTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputDurationTest.kt
@@ -1,20 +1,20 @@
package app.aaps.plugins.automation.elements
import app.aaps.plugins.automation.triggers.TriggerTestBase
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.Test
class InputDurationTest : TriggerTestBase() {
@Test fun setValueTest() {
var i = InputDuration(5, InputDuration.TimeUnit.MINUTES)
- Assertions.assertEquals(5, i.value)
- Assertions.assertEquals(InputDuration.TimeUnit.MINUTES, i.unit)
+ assertThat(i.value).isEqualTo(5)
+ assertThat(i.unit).isEqualTo(InputDuration.TimeUnit.MINUTES)
i = InputDuration(5, InputDuration.TimeUnit.HOURS)
- Assertions.assertEquals(5, i.value)
- Assertions.assertEquals(InputDuration.TimeUnit.HOURS, i.unit)
- Assertions.assertEquals(5 * 60, i.getMinutes())
+ assertThat(i.value).isEqualTo(5)
+ assertThat(i.unit).isEqualTo(InputDuration.TimeUnit.HOURS)
+ assertThat(i.getMinutes()).isEqualTo(5 * 60)
i.setMinutes(60)
- Assertions.assertEquals(1, i.value)
+ assertThat(i.value).isEqualTo(1)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputInsulinTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputInsulinTest.kt
index 7aaac4450e..968f904627 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputInsulinTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputInsulinTest.kt
@@ -1,7 +1,7 @@
package app.aaps.plugins.automation.elements
import app.aaps.plugins.automation.triggers.TriggerTestBase
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.Test
class InputInsulinTest : TriggerTestBase() {
@@ -9,6 +9,6 @@ class InputInsulinTest : TriggerTestBase() {
@Test fun setValueTest() {
val i = InputInsulin()
i.value = 5.0
- Assertions.assertEquals(5.0, i.value, 0.01)
+ assertThat(i.value).isWithin(0.01).of(5.0)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputPercentTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputPercentTest.kt
index b7a0941824..d8298f7daf 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputPercentTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputPercentTest.kt
@@ -1,7 +1,7 @@
package app.aaps.plugins.automation.elements
import app.aaps.plugins.automation.triggers.TriggerTestBase
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.Test
class InputPercentTest : TriggerTestBase() {
@@ -9,6 +9,6 @@ class InputPercentTest : TriggerTestBase() {
@Test fun setValueTest() {
val i = InputPercent()
i.value = 10.0
- Assertions.assertEquals(10.0, i.value, 0.01)
+ assertThat(i.value).isWithin(0.01).of(10.0)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputProfileNameTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputProfileNameTest.kt
index abb47c9377..42810b4a09 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputProfileNameTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputProfileNameTest.kt
@@ -1,15 +1,15 @@
package app.aaps.plugins.automation.elements
import app.aaps.plugins.automation.triggers.TriggerTestBase
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.Test
class InputProfileNameTest : TriggerTestBase() {
@Test fun setValue() {
val inputProfileName = InputProfileName(rh, activePlugin, "Test")
- Assertions.assertEquals("Test", inputProfileName.value)
+ assertThat(inputProfileName.value).isEqualTo("Test")
inputProfileName.value = "Test2"
- Assertions.assertEquals("Test2", inputProfileName.value)
+ assertThat(inputProfileName.value).isEqualTo("Test2")
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputStringTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputStringTest.kt
index 6f38866a2e..66155c69f7 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputStringTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputStringTest.kt
@@ -1,7 +1,7 @@
package app.aaps.plugins.automation.elements
import app.aaps.plugins.automation.triggers.TriggerTestBase
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.Test
class InputStringTest : TriggerTestBase() {
@@ -9,6 +9,6 @@ class InputStringTest : TriggerTestBase() {
@Test fun setValueTest() {
val i = InputString()
i.value = "asd"
- Assertions.assertEquals("asd", i.value)
+ assertThat(i.value).isEqualTo("asd")
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputTempTargetTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputTempTargetTest.kt
index 314fb2afa8..e7afa04635 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputTempTargetTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/InputTempTargetTest.kt
@@ -2,7 +2,7 @@ package app.aaps.plugins.automation.elements
import app.aaps.core.interfaces.db.GlucoseUnit
import app.aaps.plugins.automation.triggers.TriggerTestBase
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.Test
class InputTempTargetTest : TriggerTestBase() {
@@ -11,10 +11,10 @@ class InputTempTargetTest : TriggerTestBase() {
val i = InputTempTarget(profileFunction)
i.units = GlucoseUnit.MMOL
i.value = 5.0
- Assertions.assertEquals(5.0, i.value, 0.01)
+ assertThat(i.value).isWithin(0.01).of(5.0)
i.units = GlucoseUnit.MGDL
i.value = 100.0
- Assertions.assertEquals(100.0, i.value, 0.01)
- Assertions.assertEquals(GlucoseUnit.MGDL, i.units)
+ assertThat(i.value).isWithin(0.01).of(100.0)
+ assertThat(i.units).isEqualTo(GlucoseUnit.MGDL)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/LabelWithElementTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/LabelWithElementTest.kt
index 612a3abc7b..c173ffff28 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/LabelWithElementTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/LabelWithElementTest.kt
@@ -1,16 +1,17 @@
package app.aaps.plugins.automation.elements
import app.aaps.plugins.automation.triggers.TriggerTestBase
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.Test
+import kotlin.test.assertIs
class LabelWithElementTest : TriggerTestBase() {
@Test
fun constructorTest() {
val l = LabelWithElement(rh, "A", "B", InputInsulin())
- Assertions.assertEquals("A", l.textPre)
- Assertions.assertEquals("B", l.textPost)
- Assertions.assertEquals(InputInsulin::class.java, l.element!!.javaClass)
+ assertThat(l.textPre).isEqualTo("A")
+ assertThat(l.textPost).isEqualTo("B")
+ assertIs(l.element)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/LayoutBuilderTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/LayoutBuilderTest.kt
index ab0cae1c6d..c76f25a83e 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/LayoutBuilderTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/LayoutBuilderTest.kt
@@ -3,7 +3,7 @@ package app.aaps.plugins.automation.elements
import app.aaps.shared.tests.TestBase
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.Test
class LayoutBuilderTest : TestBase() {
@@ -14,15 +14,15 @@ class LayoutBuilderTest : TestBase() {
val layoutBuilder = LayoutBuilder()
val inputInsulin = InputInsulin()
layoutBuilder.add(inputInsulin)
- Assertions.assertEquals(1, layoutBuilder.mElements.size)
+ assertThat(layoutBuilder.mElements).hasSize(1)
}
@Test fun addConditionalTest() {
val layoutBuilder = LayoutBuilder()
val inputInsulin = InputInsulin()
layoutBuilder.maybeAdd(inputInsulin, true)
- Assertions.assertEquals(1, layoutBuilder.mElements.size)
+ assertThat(layoutBuilder.mElements).hasSize(1)
layoutBuilder.maybeAdd(inputInsulin, false)
- Assertions.assertEquals(1, layoutBuilder.mElements.size)
+ assertThat(layoutBuilder.mElements).hasSize(1)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/StaticLabelTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/StaticLabelTest.kt
index a753926321..c3b59768f1 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/StaticLabelTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/elements/StaticLabelTest.kt
@@ -2,7 +2,7 @@ package app.aaps.plugins.automation.elements
import app.aaps.plugins.automation.triggers.TriggerDummy
import app.aaps.plugins.automation.triggers.TriggerTestBase
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.Test
import org.mockito.Mockito.`when`
@@ -10,9 +10,9 @@ class StaticLabelTest : TriggerTestBase() {
@Test fun constructor() {
var sl = StaticLabel(rh, "any", TriggerDummy(injector))
- Assertions.assertEquals("any", sl.label)
+ assertThat(sl.label).isEqualTo("any")
`when`(rh.gs(app.aaps.core.ui.R.string.pumplimit)).thenReturn("pump limit")
sl = StaticLabel(rh, app.aaps.core.ui.R.string.pumplimit, TriggerDummy(injector))
- Assertions.assertEquals("pump limit", sl.label)
+ assertThat(sl.label).isEqualTo("pump limit")
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerAutosensValueTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerAutosensValueTest.kt
index 35ba9e53d8..0f5618c6f8 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerAutosensValueTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerAutosensValueTest.kt
@@ -5,11 +5,11 @@ import app.aaps.plugins.automation.elements.Comparator
import app.aaps.plugins.main.iob.iobCobCalculator.data.AutosensDataObject
import com.google.common.truth.Truth.assertThat
import org.json.JSONObject
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import org.mockito.ArgumentMatchers
import org.mockito.Mockito
import org.mockito.Mockito.`when`
+import org.skyscreamer.jsonassert.JSONAssert
class TriggerAutosensValueTest : TriggerTestBase() {
@@ -20,53 +20,53 @@ class TriggerAutosensValueTest : TriggerTestBase() {
var t = TriggerAutosensValue(injector)
t.autosens.value = 110.0
t.comparator.value = Comparator.Compare.IS_EQUAL
- Assertions.assertEquals(110.0, t.autosens.value, 0.01)
- Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t.comparator.value)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.autosens.value).isWithin(0.01).of(110.0)
+ assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
+ assertThat(t.shouldRun()).isFalse()
t = TriggerAutosensValue(injector)
t.autosens.value = 100.0
t.comparator.value = Comparator.Compare.IS_EQUAL
- Assertions.assertEquals(100.0, t.autosens.value, 0.01)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.autosens.value).isWithin(0.01).of(100.0)
+ assertThat(t.shouldRun()).isTrue()
t = TriggerAutosensValue(injector)
t.autosens.value = 50.0
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_GREATER
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerAutosensValue(injector)
t.autosens.value = 310.0
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_LESSER
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerAutosensValue(injector)
t.autosens.value = 420.0
t.comparator.value = Comparator.Compare.IS_EQUAL
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
t = TriggerAutosensValue(injector)
t.autosens.value = 390.0
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_LESSER
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerAutosensValue(injector)
t.autosens.value = 390.0
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_GREATER
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
t = TriggerAutosensValue(injector)
t.autosens.value = 20.0
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_GREATER
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerAutosensValue(injector)
t.autosens.value = 390.0
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_LESSER
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
`when`(autosensDataStore.getLastAutosensData(anyObject(), anyObject(), anyObject())).thenReturn(AutosensDataObject(injector))
t = TriggerAutosensValue(injector)
t.autosens.value = 80.0
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_LESSER
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
// Test autosensData == null and Comparator == IS_NOT_AVAILABLE
`when`(autosensDataStore.getLastAutosensData(anyObject(), anyObject(), anyObject())).thenReturn(null)
t = TriggerAutosensValue(injector)
t.comparator.value = Comparator.Compare.IS_NOT_AVAILABLE
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
}
@Test
@@ -75,8 +75,8 @@ class TriggerAutosensValueTest : TriggerTestBase() {
t.autosens.value = 213.0
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_LESSER
val t1 = t.duplicate() as TriggerAutosensValue
- Assertions.assertEquals(213.0, t1.autosens.value, 0.01)
- Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
+ assertThat(t1.autosens.value).isWithin(0.01).of(213.0)
+ assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
}
private var asJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"value\":410},\"type\":\"TriggerAutosensValue\"}"
@@ -86,7 +86,7 @@ class TriggerAutosensValueTest : TriggerTestBase() {
val t = TriggerAutosensValue(injector)
t.autosens.value = 410.0
t.comparator.value = Comparator.Compare.IS_EQUAL
- Assertions.assertEquals(asJson, t.toJSON())
+ JSONAssert.assertEquals(asJson, t.toJSON(), true)
}
@Test
@@ -95,15 +95,13 @@ class TriggerAutosensValueTest : TriggerTestBase() {
t.autosens.value = 410.0
t.comparator.value = Comparator.Compare.IS_EQUAL
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerAutosensValue
- Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
- Assertions.assertEquals(410.0, t2.autosens.value, 0.01)
+ assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
+ assertThat(t2.autosens.value).isWithin(0.01).of(410.0)
}
@Test fun iconTest() {
assertThat(TriggerAutosensValue(injector).icon().get()).isEqualTo(R.drawable.ic_as)
}
- private fun generateAutosensData(): AutosensDataObject {
- return AutosensDataObject(injector)
- }
-}
\ No newline at end of file
+ private fun generateAutosensData() = AutosensDataObject(injector)
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBTDeviceTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBTDeviceTest.kt
index 91b912d9ef..c0a7cfd89a 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBTDeviceTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBTDeviceTest.kt
@@ -3,8 +3,8 @@ package app.aaps.plugins.automation.triggers
import app.aaps.plugins.automation.elements.ComparatorConnect
import com.google.common.truth.Truth.assertThat
import org.json.JSONObject
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
+import org.skyscreamer.jsonassert.JSONAssert
class TriggerBTDeviceTest : TriggerTestBase() {
@@ -19,14 +19,14 @@ class TriggerBTDeviceTest : TriggerTestBase() {
@Test fun toJSON() {
val t = TriggerBTDevice(injector)
t.btDevice.value = someName
- Assertions.assertEquals(btJson, t.toJSON())
+ JSONAssert.assertEquals(btJson, t.toJSON(), true)
}
@Test
fun fromJSON() {
val t2 = TriggerDummy(injector).instantiate(JSONObject(btJson)) as TriggerBTDevice
- Assertions.assertEquals(ComparatorConnect.Compare.ON_CONNECT, t2.comparator.value)
- Assertions.assertEquals("Headset", t2.btDevice.value)
+ assertThat(t2.comparator.value).isEqualTo(ComparatorConnect.Compare.ON_CONNECT)
+ assertThat(t2.btDevice.value).isEqualTo("Headset")
}
@Test
@@ -40,7 +40,7 @@ class TriggerBTDeviceTest : TriggerTestBase() {
it.btDevice.value = someName
}
val t1 = t.duplicate() as TriggerBTDevice
- Assertions.assertEquals("Headset", t1.btDevice.value)
- Assertions.assertEquals(ComparatorConnect.Compare.ON_DISCONNECT, t.comparator.value)
+ assertThat(t1.btDevice.value).isEqualTo("Headset")
+ assertThat(t.comparator.value).isEqualTo(ComparatorConnect.Compare.ON_DISCONNECT)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBgTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBgTest.kt
index 47bcb54ad3..1adcd1f3cc 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBgTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBgTest.kt
@@ -6,10 +6,11 @@ import app.aaps.database.entities.GlucoseValue
import app.aaps.plugins.automation.elements.Comparator
import com.google.common.truth.Truth.assertThat
import org.json.JSONObject
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mockito.`when`
+import org.skyscreamer.jsonassert.JSONAssert
class TriggerBgTest : TriggerTestBase() {
@@ -22,37 +23,37 @@ class TriggerBgTest : TriggerTestBase() {
fun shouldRunTest() {
`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(generateOneCurrentRecordBgData())
var t: TriggerBg = TriggerBg(injector).setUnits(GlucoseUnit.MMOL).setValue(4.1).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(214.0).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(214.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(214.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(215.0).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(215.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(215.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(ArrayList())
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
t = TriggerBg(injector).comparator(Comparator.Compare.IS_NOT_AVAILABLE)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
}
@Test
fun copyConstructorTest() {
val t: TriggerBg = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
val t1 = t.duplicate() as TriggerBg
- Assertions.assertEquals(213.0, t1.bg.value, 0.01)
- Assertions.assertEquals(GlucoseUnit.MGDL, t1.bg.units)
- Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
+ assertThat(t1.bg.value).isWithin(0.01).of(213.0)
+ assertThat(t1.bg.units).isEqualTo(GlucoseUnit.MGDL)
+ assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
}
private var bgJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"bg\":4.1,\"units\":\"mmol\"},\"type\":\"TriggerBg\"}"
@@ -60,16 +61,16 @@ class TriggerBgTest : TriggerTestBase() {
@Test
fun toJSONTest() {
val t: TriggerBg = TriggerBg(injector).setUnits(GlucoseUnit.MMOL).setValue(4.1).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertEquals(bgJson, t.toJSON())
+ JSONAssert.assertEquals(bgJson, t.toJSON(), true)
}
@Test
fun fromJSONTest() {
val t: TriggerBg = TriggerBg(injector).setUnits(GlucoseUnit.MMOL).setValue(4.1).comparator(Comparator.Compare.IS_EQUAL)
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerBg
- Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
- Assertions.assertEquals(4.1, t2.bg.value, 0.01)
- Assertions.assertEquals(GlucoseUnit.MMOL, t2.bg.units)
+ assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
+ assertThat(t2.bg.value).isWithin(0.01).of(4.1)
+ assertThat(t2.bg.units).isEqualTo(GlucoseUnit.MMOL)
}
@Test
@@ -82,4 +83,4 @@ class TriggerBgTest : TriggerTestBase() {
list.add(InMemoryGlucoseValue(value = 214.0, timestamp = now - 1, trendArrow = GlucoseValue.TrendArrow.FLAT, sourceSensor = GlucoseValue.SourceSensor.UNKNOWN))
return list
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBolusAgoTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBolusAgoTest.kt
index 8f53218183..4e5cf8e277 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBolusAgoTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerBolusAgoTest.kt
@@ -7,9 +7,9 @@ import com.google.common.truth.Truth.assertThat
import io.reactivex.rxjava3.core.Single
import org.json.JSONException
import org.json.JSONObject
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import org.mockito.Mockito.`when`
+import org.skyscreamer.jsonassert.JSONAssert
class TriggerBolusAgoTest : TriggerTestBase() {
@@ -29,26 +29,26 @@ class TriggerBolusAgoTest : TriggerTestBase() {
)
`when`(dateUtil.now()).thenReturn(now + 10 * 60 * 1000) // set current time to now + 10 min
var t = TriggerBolusAgo(injector).setValue(110).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertEquals(110, t.minutesAgo.value)
- Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t.comparator.value)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.minutesAgo.value).isEqualTo(110)
+ assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
+ assertThat(t.shouldRun()).isFalse()
t = TriggerBolusAgo(injector).setValue(10).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertEquals(10, t.minutesAgo.value)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.minutesAgo.value).isEqualTo(10)
+ assertThat(t.shouldRun()).isTrue()
t = TriggerBolusAgo(injector).setValue(5).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerBolusAgo(injector).setValue(310).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerBolusAgo(injector).setValue(420).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
t = TriggerBolusAgo(injector).setValue(390).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerBolusAgo(injector).setValue(390).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
t = TriggerBolusAgo(injector).setValue(2).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerBolusAgo(injector).setValue(390).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
// Set last bolus time to 0
`when`(repository.getLastBolusRecordOfTypeWrapped(Bolus.Type.NORMAL)).thenReturn(
Single.just(
@@ -62,30 +62,30 @@ class TriggerBolusAgoTest : TriggerTestBase() {
)
)
t = TriggerBolusAgo(injector).comparator(Comparator.Compare.IS_NOT_AVAILABLE)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
}
@Test fun copyConstructorTest() {
val t: TriggerBolusAgo = TriggerBolusAgo(injector).setValue(213).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
val t1 = t.duplicate() as TriggerBolusAgo
- Assertions.assertEquals(213, t1.minutesAgo.value)
- Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
+ assertThat(t1.minutesAgo.value).isEqualTo(213)
+ assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
}
private var lbJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"minutesAgo\":410},\"type\":\"TriggerBolusAgo\"}"
@Test fun toJSONTest() {
val t: TriggerBolusAgo = TriggerBolusAgo(injector).setValue(410).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertEquals(lbJson, t.toJSON())
+ JSONAssert.assertEquals(lbJson, t.toJSON(), true)
}
@Test @Throws(JSONException::class) fun fromJSONTest() {
val t: TriggerBolusAgo = TriggerBolusAgo(injector).setValue(410).comparator(Comparator.Compare.IS_EQUAL)
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerBolusAgo
- Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
- Assertions.assertEquals(410, t2.minutesAgo.value)
+ assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
+ assertThat(t2.minutesAgo.value).isEqualTo(410)
}
@Test fun iconTest() {
assertThat(TriggerBolusAgo(injector).icon().get()).isEqualTo(app.aaps.core.main.R.drawable.ic_bolus)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerCOBTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerCOBTest.kt
index 83e0930252..9829977f1d 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerCOBTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerCOBTest.kt
@@ -4,11 +4,11 @@ import app.aaps.core.interfaces.iob.CobInfo
import app.aaps.plugins.automation.elements.Comparator
import com.google.common.truth.Truth.assertThat
import org.json.JSONObject
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.ArgumentMatchers
import org.mockito.Mockito.`when`
+import org.skyscreamer.jsonassert.JSONAssert
class TriggerCOBTest : TriggerTestBase() {
@@ -20,44 +20,44 @@ class TriggerCOBTest : TriggerTestBase() {
// COB value is 6
`when`(iobCobCalculator.getCobInfo("AutomationTriggerCOB")).thenReturn(CobInfo(0, 6.0, 2.0))
var t: TriggerCOB = TriggerCOB(injector).setValue(1.0).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
t = TriggerCOB(injector).setValue(6.0).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerCOB(injector).setValue(5.0).comparator(Comparator.Compare.IS_GREATER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerCOB(injector).setValue(5.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerCOB(injector).setValue(6.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerCOB(injector).setValue(1.0).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
t = TriggerCOB(injector).setValue(10.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerCOB(injector).setValue(5.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
}
@Test fun copyConstructorTest() {
val t: TriggerCOB = TriggerCOB(injector).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
- Assertions.assertEquals(213.0, t.cob.value, 0.01)
- Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
+ assertThat(t.cob.value).isWithin(0.01).of(213.0)
+ assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
}
private var bgJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"carbs\":4},\"type\":\"TriggerCOB\"}"
@Test fun toJSONTest() {
val t: TriggerCOB = TriggerCOB(injector).setValue(4.0).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertEquals(bgJson, t.toJSON())
+ JSONAssert.assertEquals(bgJson, t.toJSON(), true)
}
@Test
fun fromJSONTest() {
val t: TriggerCOB = TriggerCOB(injector).setValue(4.0).comparator(Comparator.Compare.IS_EQUAL)
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerCOB
- Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
- Assertions.assertEquals(4.0, t2.cob.value, 0.01)
+ assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
+ assertThat(t2.cob.value).isWithin(0.01).of(4.0)
}
@Test fun iconTest() {
assertThat(TriggerCOB(injector).icon().get()).isEqualTo(app.aaps.core.main.R.drawable.ic_cp_bolus_carbs)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerDummyTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerDummyTest.kt
index c0fcd70444..8e2f9da367 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerDummyTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerDummyTest.kt
@@ -1,7 +1,7 @@
package app.aaps.plugins.automation.triggers
+import kotlin.test.assertIs
import org.json.JSONObject
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
class TriggerDummyTest : TriggerTestBase() {
@@ -9,13 +9,13 @@ class TriggerDummyTest : TriggerTestBase() {
@Test
fun instantiateTest() {
var trigger: Trigger? = TriggerDummy(injector).instantiate(JSONObject("{\"data\":{},\"type\":\"info.nightscout.androidaps.plugins.general.automation.triggers.TriggerDummy\"}"))
- Assertions.assertTrue(trigger is TriggerDummy)
+ assertIs(trigger)
trigger = TriggerDummy(injector).instantiate(JSONObject("{\"data\":{},\"type\":\"app.aaps.plugins.automation.triggers.TriggerDummy\"}"))
- Assertions.assertTrue(trigger is TriggerDummy)
+ assertIs(trigger)
trigger = TriggerDummy(injector).instantiate(JSONObject("{\"data\":{},\"type\":\"TriggerDummy\"}"))
- Assertions.assertTrue(trigger is TriggerDummy)
+ assertIs(trigger)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerHeartRateTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerHeartRateTest.kt
index 27e395df15..5e7b7a5c7f 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerHeartRateTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerHeartRateTest.kt
@@ -3,19 +3,20 @@ package app.aaps.plugins.automation.triggers
import app.aaps.database.entities.HeartRate
import app.aaps.plugins.automation.R
import app.aaps.plugins.automation.elements.Comparator
+import com.google.common.truth.Truth.assertThat
import io.reactivex.rxjava3.core.Single
import org.json.JSONObject
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import org.mockito.Mockito.verify
import org.mockito.Mockito.verifyNoMoreInteractions
import org.mockito.Mockito.`when`
+import org.skyscreamer.jsonassert.JSONAssert
class TriggerHeartRateTest : TriggerTestBase() {
@Test
fun friendlyName() {
- Assertions.assertEquals(R.string.triggerHeartRate, TriggerHeartRate(injector).friendlyName())
+ assertThat(TriggerHeartRate(injector).friendlyName()).isEqualTo(R.string.triggerHeartRate)
}
@Test
@@ -23,7 +24,7 @@ class TriggerHeartRateTest : TriggerTestBase() {
val t = TriggerHeartRate(injector)
`when`(rh.gs(Comparator.Compare.IS_EQUAL_OR_GREATER.stringRes)).thenReturn(">")
`when`(rh.gs(R.string.triggerHeartRateDesc, ">", 80.0)).thenReturn("test")
- Assertions.assertEquals("test", t.friendlyDescription())
+ assertThat(t.friendlyDescription()).isEqualTo("test")
}
@Test
@@ -33,16 +34,16 @@ class TriggerHeartRateTest : TriggerTestBase() {
comparator.value = Comparator.Compare.IS_GREATER
}
val dup = t.duplicate() as TriggerHeartRate
- Assertions.assertNotSame(t, dup)
- Assertions.assertEquals(100.0, dup.heartRate.value, 0.01)
- Assertions.assertEquals(Comparator.Compare.IS_GREATER, dup.comparator.value)
+ assertThat(dup).isNotSameInstanceAs(t)
+ assertThat(dup.heartRate.value).isWithin(0.01).of(100.0)
+ assertThat(dup.comparator.value).isEqualTo(Comparator.Compare.IS_GREATER)
}
@Test
fun shouldRunNotAvailable() {
val t = TriggerHeartRate(injector).apply { comparator.value = Comparator.Compare.IS_NOT_AVAILABLE }
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
verifyNoMoreInteractions(repository)
}
@@ -53,7 +54,7 @@ class TriggerHeartRateTest : TriggerTestBase() {
comparator.value = Comparator.Compare.IS_GREATER
}
`when`(repository.getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)).thenReturn(Single.just(emptyList()))
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
verify(repository).getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)
verifyNoMoreInteractions(repository)
}
@@ -69,7 +70,7 @@ class TriggerHeartRateTest : TriggerTestBase() {
HeartRate(duration = 300_000, timestamp = now, beatsPerMinute = 60.0, device = "test"),
)
`when`(repository.getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)).thenReturn(Single.just(hrs))
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
verify(repository).getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)
verifyNoMoreInteractions(repository)
}
@@ -84,7 +85,7 @@ class TriggerHeartRateTest : TriggerTestBase() {
HeartRate(duration = 300_000, timestamp = now, beatsPerMinute = 120.0, device = "test"),
)
`when`(repository.getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)).thenReturn(Single.just(hrs))
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
verify(repository).getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)
verifyNoMoreInteractions(repository)
}
@@ -95,9 +96,9 @@ class TriggerHeartRateTest : TriggerTestBase() {
heartRate.value = 100.0
comparator.value = Comparator.Compare.IS_GREATER
}
- Assertions.assertEquals(Comparator.Compare.IS_GREATER, t.comparator.value)
+ assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_GREATER)
- Assertions.assertEquals("""{"data":{"comparator":"IS_GREATER","heartRate":100},"type":"TriggerHeartRate"}""".trimMargin(), t.toJSON())
+ JSONAssert.assertEquals("""{"data":{"comparator":"IS_GREATER","heartRate":100},"type":"TriggerHeartRate"}""", t.toJSON(), true)
}
@Test
@@ -107,7 +108,7 @@ class TriggerHeartRateTest : TriggerTestBase() {
"""{"data":{"comparator":"IS_GREATER","heartRate":100},"type":"TriggerHeartRate"}"""
)
) as TriggerHeartRate
- Assertions.assertEquals(Comparator.Compare.IS_GREATER, t.comparator.value)
- Assertions.assertEquals(100.0, t.heartRate.value, 0.01)
+ assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_GREATER)
+ assertThat(t.heartRate.value).isWithin(0.01).of(100.0)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerIobTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerIobTest.kt
index e90b719e62..4afe63be8a 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerIobTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerIobTest.kt
@@ -5,11 +5,11 @@ import app.aaps.plugins.automation.R
import app.aaps.plugins.automation.elements.Comparator
import com.google.common.truth.Truth.assertThat
import org.json.JSONObject
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.ArgumentMatchers
import org.mockito.Mockito.`when`
+import org.skyscreamer.jsonassert.JSONAssert
class TriggerIobTest : TriggerTestBase() {
@@ -20,43 +20,43 @@ class TriggerIobTest : TriggerTestBase() {
@Test fun shouldRunTest() {
`when`(iobCobCalculator.calculateFromTreatmentsAndTemps(ArgumentMatchers.anyLong(), anyObject())).thenReturn(generateIobRecordData())
var t: TriggerIob = TriggerIob(injector).setValue(1.1).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
t = TriggerIob(injector).setValue(1.0).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerIob(injector).setValue(0.8).comparator(Comparator.Compare.IS_GREATER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerIob(injector).setValue(0.8).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerIob(injector).setValue(0.9).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerIob(injector).setValue(1.2).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerIob(injector).setValue(1.1).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
t = TriggerIob(injector).setValue(1.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerIob(injector).setValue(0.9).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
}
@Test fun copyConstructorTest() {
val t: TriggerIob = TriggerIob(injector).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
- Assertions.assertEquals(213.0, t.insulin.value, 0.01)
- Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
+ assertThat(t.insulin.value).isWithin(0.01).of(213.0)
+ assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
}
private var bgJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"insulin\":4.1},\"type\":\"TriggerIob\"}"
@Test fun toJSONTest() {
val t: TriggerIob = TriggerIob(injector).setValue(4.1).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertEquals(bgJson, t.toJSON())
+ JSONAssert.assertEquals(bgJson, t.toJSON(), true)
}
@Test
fun fromJSONTest() {
val t: TriggerIob = TriggerIob(injector).setValue(4.1).comparator(Comparator.Compare.IS_EQUAL)
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerIob
- Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
- Assertions.assertEquals(4.1, t2.insulin.value, 0.01)
+ assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
+ assertThat(t2.insulin.value).isWithin(0.01).of(4.1)
}
@Test fun iconTest() {
@@ -68,4 +68,4 @@ class TriggerIobTest : TriggerTestBase() {
iobTotal.iob = 1.0
return iobTotal
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerLocationTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerLocationTest.kt
index c6a7ab9dff..fc082c1ca2 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerLocationTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerLocationTest.kt
@@ -6,7 +6,6 @@ import app.aaps.plugins.automation.elements.InputLocationMode
import com.google.common.truth.Truth.assertThat
import org.json.JSONException
import org.json.JSONObject
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mockito.`when`
@@ -24,10 +23,10 @@ class TriggerLocationTest : TriggerTestBase() {
t.distance.setValue(2.0)
t.modeSelected.value = InputLocationMode.Mode.INSIDE
val t1 = t.duplicate() as TriggerLocation
- Assertions.assertEquals(213.0, t1.latitude.value, 0.01)
- Assertions.assertEquals(212.0, t1.longitude.value, 0.01)
- Assertions.assertEquals(2.0, t1.distance.value, 0.01)
- Assertions.assertEquals(InputLocationMode.Mode.INSIDE, t1.modeSelected.value)
+ assertThat(t1.latitude.value).isWithin(0.01).of(213.0)
+ assertThat(t1.longitude.value).isWithin(0.01).of(212.0)
+ assertThat(t1.distance.value).isWithin(0.01).of(2.0)
+ assertThat(t1.modeSelected.value).isEqualTo(InputLocationMode.Mode.INSIDE)
}
@Test fun shouldRunTest() {
@@ -37,12 +36,12 @@ class TriggerLocationTest : TriggerTestBase() {
t.distance.setValue(2.0)
// t.modeSelected.setValue(InputLocationMode.Mode.OUTSIDE);
`when`(locationDataContainer.lastLocation).thenReturn(null)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
`when`(locationDataContainer.lastLocation).thenReturn(mockedLocation())
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerLocation(injector)
t.distance.setValue(-500.0)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
//Test of GOING_IN - last mode should be OUTSIDE, and current mode should be INSIDE
t = TriggerLocation(injector)
@@ -51,9 +50,9 @@ class TriggerLocationTest : TriggerTestBase() {
`when`(locationDataContainer.lastLocation).thenReturn(null)
`when`(locationDataContainer.lastLocation).thenReturn(mockedLocationOut())
t.modeSelected.value = InputLocationMode.Mode.GOING_IN
- Assertions.assertEquals(t.lastMode, InputLocationMode.Mode.OUTSIDE)
- Assertions.assertEquals(t.currentMode(5.0), InputLocationMode.Mode.INSIDE)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(InputLocationMode.Mode.OUTSIDE).isEqualTo(t.lastMode)
+ assertThat(InputLocationMode.Mode.INSIDE).isEqualTo(t.currentMode(5.0))
+ assertThat(t.shouldRun()).isTrue()
//Test of GOING_OUT - last mode should be INSIDE, and current mode should be OUTSIDE
// Currently unavailable due to problems with Location mocking
@@ -67,7 +66,7 @@ class TriggerLocationTest : TriggerTestBase() {
t.distance.setValue(2.0)
t.modeSelected.value = InputLocationMode.Mode.OUTSIDE
// t.modeSelected = t.modeSelected.value
- Assertions.assertEquals(locationJson, t.toJSON())
+ assertThat(t.toJSON()).isEqualTo(locationJson)
}
@Test @Throws(JSONException::class) fun fromJSONTest() {
@@ -77,18 +76,18 @@ class TriggerLocationTest : TriggerTestBase() {
t.distance.setValue(2.0)
t.modeSelected.value = InputLocationMode.Mode.INSIDE
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerLocation
- Assertions.assertEquals(t.latitude.value, t2.latitude.value, 0.01)
- Assertions.assertEquals(t.longitude.value, t2.longitude.value, 0.01)
- Assertions.assertEquals(t.distance.value, t2.distance.value, 0.01)
- Assertions.assertEquals(t.modeSelected.value, t2.modeSelected.value)
+ assertThat(t2.latitude.value).isWithin(0.01).of(t.latitude.value)
+ assertThat(t2.longitude.value).isWithin(0.01).of(t.longitude.value)
+ assertThat(t2.distance.value).isWithin(0.01).of(t.distance.value)
+ assertThat(t2.modeSelected.value).isEqualTo(t.modeSelected.value)
}
@Test fun friendlyNameTest() {
- Assertions.assertEquals(R.string.location, TriggerLocation(injector).friendlyName())
+ assertThat(TriggerLocation(injector).friendlyName()).isEqualTo(R.string.location)
}
@Test fun friendlyDescriptionTest() {
- Assertions.assertEquals(null, TriggerLocation(injector).friendlyDescription()) //not mocked }
+ assertThat(TriggerLocation(injector).friendlyDescription()).isNull() //not mocked }
}
@Test fun iconTest() {
@@ -110,4 +109,4 @@ class TriggerLocationTest : TriggerTestBase() {
newLocation.accuracy = 1f
return newLocation
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerProfilePercentTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerProfilePercentTest.kt
index fdaba24f13..9becc46ad7 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerProfilePercentTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerProfilePercentTest.kt
@@ -4,10 +4,10 @@ import app.aaps.plugins.automation.R
import app.aaps.plugins.automation.elements.Comparator
import com.google.common.truth.Truth.assertThat
import org.json.JSONObject
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mockito.`when`
+import org.skyscreamer.jsonassert.JSONAssert
class TriggerProfilePercentTest : TriggerTestBase() {
@@ -17,43 +17,43 @@ class TriggerProfilePercentTest : TriggerTestBase() {
@Test fun shouldRunTest() {
var t: TriggerProfilePercent = TriggerProfilePercent(injector).setValue(101.0).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
t = TriggerProfilePercent(injector).setValue(100.0).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerProfilePercent(injector).setValue(100.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerProfilePercent(injector).setValue(90.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerProfilePercent(injector).setValue(100.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerProfilePercent(injector).setValue(101.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerProfilePercent(injector).setValue(215.0).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
t = TriggerProfilePercent(injector).setValue(110.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
t = TriggerProfilePercent(injector).setValue(90.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
}
@Test fun copyConstructorTest() {
val t: TriggerProfilePercent = TriggerProfilePercent(injector).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
val t1 = t.duplicate() as TriggerProfilePercent
- Assertions.assertEquals(213.0, t1.pct.value, 0.01)
- Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
+ assertThat( t1.pct.value).isWithin(0.01).of(213.0)
+ assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
}
private val bgJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"percentage\":110},\"type\":\"TriggerProfilePercent\"}"
@Test fun toJSONTest() {
val t: TriggerProfilePercent = TriggerProfilePercent(injector).setValue(110.0).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertEquals(bgJson, t.toJSON())
+ JSONAssert.assertEquals(bgJson, t.toJSON(), true)
}
@Test fun fromJSONTest() {
val t: TriggerProfilePercent = TriggerProfilePercent(injector).setValue(120.0).comparator(Comparator.Compare.IS_EQUAL)
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerProfilePercent
- Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
- Assertions.assertEquals(120.0, t2.pct.value, 0.01)
+ assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
+ assertThat(t2.pct.value).isWithin(0.01).of(120.0)
}
@Test fun iconTest() {
@@ -61,6 +61,6 @@ class TriggerProfilePercentTest : TriggerTestBase() {
}
@Test fun friendlyNameTest() {
- Assertions.assertEquals(R.string.profilepercentage, TriggerProfilePercent(injector).friendlyName()) // not mocked
+ assertThat(TriggerProfilePercent(injector).friendlyName()).isEqualTo(R.string.profilepercentage) // not mocked
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerPumpLastConnectionTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerPumpLastConnectionTest.kt
index 3189efd24c..e11ef0461b 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerPumpLastConnectionTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerPumpLastConnectionTest.kt
@@ -4,9 +4,9 @@ import app.aaps.plugins.automation.R
import app.aaps.plugins.automation.elements.Comparator
import com.google.common.truth.Truth.assertThat
import org.json.JSONObject
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import org.mockito.Mockito.`when`
+import org.skyscreamer.jsonassert.JSONAssert
class TriggerPumpLastConnectionTest : TriggerTestBase() {
@@ -14,42 +14,42 @@ class TriggerPumpLastConnectionTest : TriggerTestBase() {
fun shouldRunTest() {
// System.currentTimeMillis() is always 0
// and so is every last connection time
- Assertions.assertEquals(0L, testPumpPlugin.lastDataTime())
+ assertThat(testPumpPlugin.lastDataTime()).isEqualTo(0L)
`when`(dateUtil.now()).thenReturn(now + 10 * 60 * 1000) // set current time to now + 10 min
var t = TriggerPumpLastConnection(injector).setValue(110).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertEquals(110, t.minutesAgo.value)
- Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t.comparator.value)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.minutesAgo.value).isEqualTo(110)
+ assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
+ assertThat(t.shouldRun()).isFalse()
t = TriggerPumpLastConnection(injector).setValue(10).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertEquals(10, t.minutesAgo.value)
- Assertions.assertFalse(t.shouldRun()) // 0 == 10 -> FALSE
+ assertThat(t.minutesAgo.value).isEqualTo(10)
+ assertThat(t.shouldRun()).isFalse() // 0 == 10 -> FALSE
t = TriggerPumpLastConnection(injector).setValue(5).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
- Assertions.assertTrue(t.shouldRun()) // 5 => 0 -> TRUE
+ assertThat(t.shouldRun()).isTrue() // 5 => 0 -> TRUE
t = TriggerPumpLastConnection(injector).setValue(310).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
- Assertions.assertFalse(t.shouldRun()) // 310 <= 0 -> FALSE
+ assertThat(t.shouldRun()).isFalse() // 310 <= 0 -> FALSE
t = TriggerPumpLastConnection(injector).setValue(420).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertFalse(t.shouldRun()) // 420 == 0 -> FALSE
+ assertThat(t.shouldRun()).isFalse() // 420 == 0 -> FALSE
}
@Test fun copyConstructorTest() {
val t: TriggerPumpLastConnection = TriggerPumpLastConnection(injector).setValue(213).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
val t1 = t.duplicate() as TriggerPumpLastConnection
- Assertions.assertEquals(213, t1.minutesAgo.value)
- Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
+ assertThat(t1.minutesAgo.value).isEqualTo(213)
+ assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
}
private var lbJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"minutesAgo\":410},\"type\":\"TriggerPumpLastConnection\"}"
@Test fun toJSONTest() {
val t: TriggerPumpLastConnection = TriggerPumpLastConnection(injector).setValue(410).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertEquals(lbJson, t.toJSON())
+ JSONAssert.assertEquals(lbJson, t.toJSON(), true)
}
@Test
fun fromJSONTest() {
val t: TriggerPumpLastConnection = TriggerPumpLastConnection(injector).setValue(410).comparator(Comparator.Compare.IS_EQUAL)
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerPumpLastConnection
- Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
- Assertions.assertEquals(410, t2.minutesAgo.value)
+ assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
+ assertThat(t2.minutesAgo.value).isEqualTo(410)
}
@Test fun iconTest() {
@@ -57,6 +57,6 @@ class TriggerPumpLastConnectionTest : TriggerTestBase() {
}
@Test fun friendlyNameTest() {
- Assertions.assertEquals(R.string.automation_trigger_pump_last_connection_label, TriggerPumpLastConnection(injector).friendlyName())
+ assertThat(TriggerPumpLastConnection(injector).friendlyName()).isEqualTo(R.string.automation_trigger_pump_last_connection_label)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerRecurringTimeTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerRecurringTimeTest.kt
index 336196ba80..fa4d367046 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerRecurringTimeTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerRecurringTimeTest.kt
@@ -2,11 +2,12 @@ package app.aaps.plugins.automation.triggers
import app.aaps.core.interfaces.utils.MidnightTime
import app.aaps.core.interfaces.utils.T
+import com.google.common.truth.Truth.assertThat
import org.json.JSONObject
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mockito
+import org.skyscreamer.jsonassert.JSONAssert
class TriggerRecurringTimeTest : TriggerTestBase() {
@@ -19,12 +20,12 @@ class TriggerRecurringTimeTest : TriggerTestBase() {
var t: TriggerRecurringTime = TriggerRecurringTime(injector).time(89)
t.days.setAll(true)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
// scheduled 1 min before
t = TriggerRecurringTime(injector).time(94)
t.days.setAll(true)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
}
private var timeJson =
@@ -33,13 +34,13 @@ class TriggerRecurringTimeTest : TriggerTestBase() {
@Test
fun toJSONTest() {
val t = TriggerRecurringTime(injector).time(4444)
- Assertions.assertEquals(timeJson, t.toJSON())
+ JSONAssert.assertEquals(timeJson, t.toJSON(), true)
}
@Test
fun fromJSONTest() {
val t = TriggerRecurringTime(injector).time(4444)
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerRecurringTime
- Assertions.assertEquals(4444, t2.time.value)
+ assertThat(t2.time.value).isEqualTo(4444)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTempTargetTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTempTargetTest.kt
index 180f6fafbe..663c89180c 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTempTargetTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTempTargetTest.kt
@@ -4,8 +4,8 @@ import app.aaps.plugins.automation.R
import app.aaps.plugins.automation.elements.ComparatorExists
import com.google.common.truth.Truth.assertThat
import org.json.JSONObject
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
+import org.skyscreamer.jsonassert.JSONAssert
class TriggerTempTargetTest : TriggerTestBase() {
@@ -13,36 +13,36 @@ class TriggerTempTargetTest : TriggerTestBase() {
@Test fun shouldRunTest() {
`when`(repository.getTemporaryTargetActiveAt(anyObject())).thenReturn(null)
var t: TriggerTempTarget = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.EXISTS)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
t = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.NOT_EXISTS)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
`when`(repository.getTemporaryTargetActiveAt(anyObject())).thenReturn(TemporaryTarget(duration = 0, highTarget = 0.0, lowTarget = 0.0, reason = TemporaryTarget.Reason.CUSTOM, timestamp = 0))
t = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.NOT_EXISTS)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
t = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.EXISTS)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
}
*/
@Test fun copyConstructorTest() {
val t: TriggerTempTarget = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.NOT_EXISTS)
val t1 = t.duplicate() as TriggerTempTarget
- Assertions.assertEquals(ComparatorExists.Compare.NOT_EXISTS, t1.comparator.value)
+ assertThat(t1.comparator.value).isEqualTo(ComparatorExists.Compare.NOT_EXISTS)
}
private var ttJson = "{\"data\":{\"comparator\":\"EXISTS\"},\"type\":\"TriggerTempTarget\"}"
@Test fun toJSONTest() {
val t: TriggerTempTarget = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.EXISTS)
- Assertions.assertEquals(ttJson, t.toJSON())
+ JSONAssert.assertEquals(ttJson, t.toJSON(), true)
}
@Test
fun fromJSONTest() {
val t: TriggerTempTarget = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.NOT_EXISTS)
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerTempTarget
- Assertions.assertEquals(ComparatorExists.Compare.NOT_EXISTS, t2.comparator.value)
+ assertThat(t2.comparator.value).isEqualTo(ComparatorExists.Compare.NOT_EXISTS)
}
@Test fun iconTest() {
assertThat(TriggerTempTarget(injector).icon().get()).isEqualTo(R.drawable.ic_keyboard_tab)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTempTargetValueTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTempTargetValueTest.kt
index ad599d9f32..5aba9e5018 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTempTargetValueTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTempTargetValueTest.kt
@@ -8,10 +8,10 @@ import app.aaps.plugins.automation.elements.Comparator
import com.google.common.truth.Truth.assertThat
import io.reactivex.rxjava3.core.Single
import org.json.JSONObject
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mockito.`when`
+import org.skyscreamer.jsonassert.JSONAssert
class TriggerTempTargetValueTest : TriggerTestBase() {
@@ -36,37 +36,37 @@ class TriggerTempTargetValueTest : TriggerTestBase() {
)
)
var t: TriggerTempTargetValue = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MMOL).setValue(7.7).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(140.0).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(140.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(140.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(139.0).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(141.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(141.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(139.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(139.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
- Assertions.assertFalse(t.shouldRun())
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
+ assertThat(t.shouldRun()).isFalse()
t = TriggerTempTargetValue(injector).comparator(Comparator.Compare.IS_NOT_AVAILABLE)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
`when`(repository.getTemporaryTargetActiveAt(dateUtil.now())).thenReturn(Single.just(ValueWrapper.Absent()))
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
}
@Test
fun copyConstructorTest() {
val t: TriggerTempTargetValue = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(140.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
val t1 = t.duplicate() as TriggerTempTargetValue
- Assertions.assertEquals(140.0, t1.ttValue.value, 0.01)
- Assertions.assertEquals(GlucoseUnit.MGDL, t1.ttValue.units)
- Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
+ assertThat(t1.ttValue.value).isWithin(0.01).of(140.0)
+ assertThat(t1.ttValue.units).isEqualTo(GlucoseUnit.MGDL)
+ assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
}
private var ttJson = "{\"data\":{\"tt\":7.7,\"comparator\":\"IS_EQUAL\",\"units\":\"mmol\"},\"type\":\"TriggerTempTargetValue\"}"
@@ -74,16 +74,16 @@ class TriggerTempTargetValueTest : TriggerTestBase() {
@Test
fun toJSONTest() {
val t: TriggerTempTargetValue = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MMOL).setValue(7.7).comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertEquals(ttJson, t.toJSON())
+ JSONAssert.assertEquals(ttJson, t.toJSON(), true)
}
@Test
fun fromJSONTest() {
val t: TriggerTempTargetValue = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MMOL).setValue(7.7).comparator(Comparator.Compare.IS_EQUAL)
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerTempTargetValue
- Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
- Assertions.assertEquals(7.7, t2.ttValue.value, 0.01)
- Assertions.assertEquals(GlucoseUnit.MMOL, t2.ttValue.units)
+ assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
+ assertThat(t2.ttValue.value).isWithin(0.01).of(7.7)
+ assertThat(t2.ttValue.units).isEqualTo(GlucoseUnit.MMOL)
}
@Test
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTimeRangeTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTimeRangeTest.kt
index a828c2035f..5eb4f3bca1 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTimeRangeTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTimeRangeTest.kt
@@ -4,10 +4,10 @@ import app.aaps.core.interfaces.utils.MidnightTime
import app.aaps.plugins.automation.R
import com.google.common.truth.Truth.assertThat
import org.json.JSONObject
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mockito.`when`
+import org.skyscreamer.jsonassert.JSONAssert
class TriggerTimeRangeTest : TriggerTestBase() {
@@ -25,47 +25,47 @@ class TriggerTimeRangeTest : TriggerTestBase() {
fun shouldRunTest() {
// range starts 1 min in the future
var t: TriggerTimeRange = TriggerTimeRange(injector).period((now + 1).toInt(), (now + 30).toInt())
- Assertions.assertEquals(false, t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
// range starts 30 min back
t = TriggerTimeRange(injector).period((now - 30).toInt(), (now + 30).toInt())
- Assertions.assertEquals(true, t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
// Period is all day long
t = TriggerTimeRange(injector).period(1, 1440)
- Assertions.assertEquals(true, t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
}
@Test
fun toJSONTest() {
val t: TriggerTimeRange = TriggerTimeRange(injector).period((now - 1).toInt(), (now + 30).toInt())
- Assertions.assertEquals(timeJson, t.toJSON())
+ JSONAssert.assertEquals(timeJson, t.toJSON(), true)
}
@Test
fun fromJSONTest() {
val t: TriggerTimeRange = TriggerTimeRange(injector).period(120, 180)
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerTimeRange
- Assertions.assertEquals((now - 1).toInt(), t2.period(753, 360).range.start)
- Assertions.assertEquals(360, t2.period(753, 360).range.end)
+ assertThat(t2.period(753, 360).range.start).isEqualTo((now - 1).toInt())
+ assertThat(t2.period(753, 360).range.end).isEqualTo(360)
}
@Test fun copyConstructorTest() {
val t = TriggerTimeRange(injector)
t.period(now.toInt(), (now + 30).toInt())
val t1 = t.duplicate() as TriggerTimeRange
- Assertions.assertEquals(now.toInt(), t1.range.start)
+ assertThat(t1.range.start).isEqualTo(now.toInt())
}
@Test fun friendlyNameTest() {
- Assertions.assertEquals(R.string.time_range, TriggerTimeRange(injector).friendlyName())
+ assertThat(TriggerTimeRange(injector).friendlyName()).isEqualTo(R.string.time_range)
}
@Test fun friendlyDescriptionTest() {
- Assertions.assertEquals("Time is between 12:34PM and 12:34PM", TriggerTimeRange(injector).friendlyDescription())
+ assertThat(TriggerTimeRange(injector).friendlyDescription()).isEqualTo("Time is between 12:34PM and 12:34PM")
}
@Test fun iconTest() {
assertThat(TriggerTimeRange(injector).icon().get()).isEqualTo(app.aaps.core.main.R.drawable.ic_access_alarm_24dp)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTimeTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTimeTest.kt
index 75736e9784..8dd027b6b7 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTimeTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerTimeTest.kt
@@ -4,9 +4,9 @@ import app.aaps.core.interfaces.utils.T
import app.aaps.plugins.automation.R
import com.google.common.truth.Truth.assertThat
import org.json.JSONObject
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import org.mockito.Mockito
+import org.skyscreamer.jsonassert.JSONAssert
class TriggerTimeTest : TriggerTestBase() {
@@ -19,11 +19,11 @@ class TriggerTimeTest : TriggerTestBase() {
// scheduled 1 min before
var t: TriggerTime = TriggerTime(injector).runAt(now - T.mins(1).msecs())
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
// scheduled 1 min in the future
t = TriggerTime(injector).runAt(now + T.mins(1).msecs())
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
}
private var timeJson = "{\"data\":{\"runAt\":1656358762000},\"type\":\"TriggerTime\"}"
@@ -31,14 +31,14 @@ class TriggerTimeTest : TriggerTestBase() {
@Test
fun toJSONTest() {
val t: TriggerTime = TriggerTime(injector).runAt(now - T.mins(1).msecs())
- Assertions.assertEquals(timeJson, t.toJSON())
+ JSONAssert.assertEquals(timeJson, t.toJSON(), true)
}
@Test
fun fromJSONTest() {
val t: TriggerTime = TriggerTime(injector).runAt(now - T.mins(1).msecs())
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerTime
- Assertions.assertEquals(now - T.mins(1).msecs(), t2.time.value)
+ assertThat(t2.time.value).isEqualTo(now - T.mins(1).msecs())
}
@Test
@@ -46,22 +46,22 @@ class TriggerTimeTest : TriggerTestBase() {
val t = TriggerTime(injector)
t.runAt(now)
val t1 = t.duplicate() as TriggerTime
- Assertions.assertEquals(now, t1.time.value)
+ assertThat(t1.time.value).isEqualTo(now)
}
@Test
fun friendlyNameTest() {
- Assertions.assertEquals(app.aaps.core.ui.R.string.time, TriggerTime(injector).friendlyName())
+ assertThat(TriggerTime(injector).friendlyName()).isEqualTo(app.aaps.core.ui.R.string.time)
}
@Test
fun friendlyDescriptionTest() {
Mockito.`when`(rh.gs(R.string.atspecifiedtime)).thenReturn("At %1\$s")
- Assertions.assertTrue(TriggerTime(injector).friendlyDescription().startsWith("At "))
+ assertThat(TriggerTime(injector).friendlyDescription()).startsWith("At ")
}
@Test
fun iconTest() {
assertThat(TriggerTime(injector).icon().get()).isEqualTo(app.aaps.core.main.R.drawable.ic_access_alarm_24dp)
}
-}
\ No newline at end of file
+}
diff --git a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerWifiSsidTest.kt b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerWifiSsidTest.kt
index cd62a20eac..f6a01be146 100644
--- a/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerWifiSsidTest.kt
+++ b/plugins/automation/src/test/kotlin/app/aaps/plugins/automation/triggers/TriggerWifiSsidTest.kt
@@ -6,9 +6,9 @@ import app.aaps.plugins.automation.elements.Comparator
import com.google.common.truth.Truth.assertThat
import org.json.JSONException
import org.json.JSONObject
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import org.mockito.Mockito.`when`
+import org.skyscreamer.jsonassert.JSONAssert
class TriggerWifiSsidTest : TriggerTestBase() {
@@ -17,40 +17,40 @@ class TriggerWifiSsidTest : TriggerTestBase() {
`when`(receiverStatusStore.lastNetworkEvent).thenReturn(e)
var t: TriggerWifiSsid = TriggerWifiSsid(injector).setValue("aSSID 1").comparator(Comparator.Compare.IS_EQUAL)
e.wifiConnected = false
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
e.wifiConnected = true
e.ssid = "otherSSID"
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
e.wifiConnected = true
e.ssid = "aSSID 1"
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
t = TriggerWifiSsid(injector).setValue("aSSID 1").comparator(Comparator.Compare.IS_NOT_AVAILABLE)
e.wifiConnected = false
- Assertions.assertTrue(t.shouldRun())
+ assertThat(t.shouldRun()).isTrue()
// no network data
`when`(receiverStatusStore.lastNetworkEvent).thenReturn(null)
- Assertions.assertFalse(t.shouldRun())
+ assertThat(t.shouldRun()).isFalse()
}
@Test fun copyConstructorTest() {
val t: TriggerWifiSsid = TriggerWifiSsid(injector).setValue("aSSID").comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
val t1 = t.duplicate() as TriggerWifiSsid
- Assertions.assertEquals("aSSID", t1.ssid.value)
- Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
+ assertThat(t1.ssid.value).isEqualTo("aSSID")
+ assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
}
var json = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"ssid\":\"aSSID\"},\"type\":\"TriggerWifiSsid\"}"
@Test fun toJSONTest() {
val t: TriggerWifiSsid = TriggerWifiSsid(injector).setValue("aSSID").comparator(Comparator.Compare.IS_EQUAL)
- Assertions.assertEquals(json, t.toJSON())
+ JSONAssert.assertEquals(json, t.toJSON(), true)
}
@Test @Throws(JSONException::class) fun fromJSONTest() {
val t: TriggerWifiSsid = TriggerWifiSsid(injector).setValue("aSSID").comparator(Comparator.Compare.IS_EQUAL)
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerWifiSsid
- Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
- Assertions.assertEquals("aSSID", t2.ssid.value)
+ assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
+ assertThat(t2.ssid.value).isEqualTo("aSSID")
}
@Test fun iconTest() {
@@ -58,10 +58,10 @@ class TriggerWifiSsidTest : TriggerTestBase() {
}
@Test fun friendlyNameTest() {
- Assertions.assertEquals(app.aaps.core.ui.R.string.ns_wifi_ssids, TriggerWifiSsid(injector).friendlyName())
+ assertThat(TriggerWifiSsid(injector).friendlyName()).isEqualTo(app.aaps.core.ui.R.string.ns_wifi_ssids)
}
@Test fun friendlyDescriptionTest() {
- Assertions.assertEquals(null, TriggerWifiSsid(injector).friendlyDescription()) //not mocked
+ assertThat(TriggerWifiSsid(injector).friendlyDescription()).isNull() //not mocked
}
-}
\ No newline at end of file
+}
diff --git a/plugins/configuration/src/main/assets/Cockpit.zip b/plugins/configuration/src/main/assets/Cockpit.zip
new file mode 100644
index 0000000000..1d37f38e9d
Binary files /dev/null and b/plugins/configuration/src/main/assets/Cockpit.zip differ
diff --git a/plugins/configuration/src/main/assets/Default Watchface.zip b/plugins/configuration/src/main/assets/Default Watchface.zip
deleted file mode 100644
index a75db9f747..0000000000
Binary files a/plugins/configuration/src/main/assets/Default Watchface.zip and /dev/null differ
diff --git a/plugins/configuration/src/main/assets/SteamPunk mgdl.zip b/plugins/configuration/src/main/assets/SteamPunk mgdl.zip
new file mode 100644
index 0000000000..a1d1ae1395
Binary files /dev/null and b/plugins/configuration/src/main/assets/SteamPunk mgdl.zip differ
diff --git a/plugins/configuration/src/main/assets/SteamPunk mmol.zip b/plugins/configuration/src/main/assets/SteamPunk mmol.zip
new file mode 100644
index 0000000000..1076b2afcf
Binary files /dev/null and b/plugins/configuration/src/main/assets/SteamPunk mmol.zip differ
diff --git a/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/maintenance/activities/CustomWatchfaceImportListActivity.kt b/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/maintenance/activities/CustomWatchfaceImportListActivity.kt
index eaf2807842..f42849b993 100644
--- a/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/maintenance/activities/CustomWatchfaceImportListActivity.kt
+++ b/plugins/configuration/src/main/kotlin/app/aaps/plugins/configuration/maintenance/activities/CustomWatchfaceImportListActivity.kt
@@ -56,7 +56,7 @@ class CustomWatchfaceImportListActivity : TranslatedDaggerAppCompatActivity() {
supportActionBar?.setDisplayShowTitleEnabled(true)
binding.recyclerview.layoutManager = LinearLayoutManager(this)
- binding.recyclerview.adapter = RecyclerViewAdapter(prefFileListProvider.listCustomWatchfaceFiles())
+ binding.recyclerview.adapter = RecyclerViewAdapter(prefFileListProvider.listCustomWatchfaceFiles().sortedBy { it.metadata[CWF_NAME] })
}
inner class RecyclerViewAdapter internal constructor(private var customWatchfaceFileList: List) : RecyclerView.Adapter() {
diff --git a/plugins/configuration/src/main/res/values-iw-rIL/strings.xml b/plugins/configuration/src/main/res/values-iw-rIL/strings.xml
index be22aad54e..36f8f5a54d 100644
--- a/plugins/configuration/src/main/res/values-iw-rIL/strings.xml
+++ b/plugins/configuration/src/main/res/values-iw-rIL/strings.xml
@@ -157,4 +157,14 @@
נא לאתחל את הסמרטפון שלכם או הפעילו מחדש את אפלקציית AndroidAPS בהגדרות המערכת \nאחרת AndroidAPS לא יוכל לבצע רישום (חשוב לעקוב ולוודא כי האלגוריתמים פועלים כראוי)!
+ פורמט הקובץ
+ נוצר ב-
+ גרסת AAPS
+ גרסת בנייה
+ מייצא את שם מכשיר המטופל\\ת
+ מייצא את דגם המכשיר
+ הצפנת קבצים
+ פורמט הצפנה חדש
+ פורמט דיבאג חדש (בלתי מוצפן)
+ פורמט ייצוא לא ידוע
diff --git a/plugins/configuration/src/main/res/values-no-rNO/strings.xml b/plugins/configuration/src/main/res/values-nb-rNO/strings.xml
similarity index 98%
rename from plugins/configuration/src/main/res/values-no-rNO/strings.xml
rename to plugins/configuration/src/main/res/values-nb-rNO/strings.xml
index c99a9a9e89..3a00df1b2a 100644
--- a/plugins/configuration/src/main/res/values-no-rNO/strings.xml
+++ b/plugins/configuration/src/main/res/values-nb-rNO/strings.xml
@@ -45,8 +45,8 @@
Start første læringsmål
RileyLink status:
Les status
- Data valg
- Innlesing av fabrikkinstillinger
+ Datavalg
+ Innlesing av fabrikkinnstillinger
Tillat automatisk rapportering av appkrasj og bruksdata til utviklerne via fabrioc.io-tjenesten.
Denne e-postadressen vedlegges krasjrapporter slik at vi kan kontakte deg i akutte tilfeller. Det er valgfritt.
Identifikasjon (e-post, Facebook eller Discord nick osv.)
@@ -81,7 +81,7 @@
Brukes for innstilling av aktive plugins
Varsel: Hvis du aktiverer og kobler til en pumpe, så vil AndroidAPS kopiere basalinnstillinger fra din profil over til pumpen og overskrive verdiene som er lagret i pumpen. Sjekk at du har riktige basalverdier i AndroidAPS. Hvis du ikke er sikker eller ikke ønsker å overskrive basalverdiene i pumpen, trykk avbryt og koble til pumpen senere.
åpne innstillinger
- NSClient-versjonen samsvarer ikke med AAPS-versjonen. Vennligst oppdater.
+ AAPSClient-versjonen samsvarer ikke med AAPS-versjonen. Vennligst oppdater.
Innstillinger
Du må angi et hovedpassord som vil bli brukt til å kryptere dine eksporterte innstillinger. Husk dette!
diff --git a/plugins/constraints/src/main/res/values-iw-rIL/strings.xml b/plugins/constraints/src/main/res/values-iw-rIL/strings.xml
index a29a6b78dd..11f46febbc 100644
--- a/plugins/constraints/src/main/res/values-iw-rIL/strings.xml
+++ b/plugins/constraints/src/main/res/values-iw-rIL/strings.xml
@@ -10,6 +10,7 @@
גרסה ישנה
גרסה ישנה מאוד
תוקף האפליקציה פג
+ בדיקה לגרסא חדשה של המערכת לא בוצעה מזה לפחות %1$d ימים! שנמוך למצב \'השהיה עקב ערך סוכר נמוך\' תתבצע לאחר %2$d ימים והלולאה תושבת אחרי %3$d ימים. חברו את המכשיר לרשת האינטרנט!
זיהינו שאתם משתמשים בגרסה שאינה בתוקף. הלולאה מושבתת!
גרסה %1$s זמינה
תוקפה של גרסה %1$s תפוג ב-%2$s
@@ -47,4 +48,6 @@
האם ברצונכם לאפס את התחלת המשימה? אתם עלולים לאבד את התקדמותכם במשימה.
הבא
הקודם
+ ביטול השלמה
+ ביטול התחלה
diff --git a/plugins/constraints/src/main/res/values-lt-rLT/exam.xml b/plugins/constraints/src/main/res/values-lt-rLT/exam.xml
index 5cc8201c2f..5ad84e1365 100644
--- a/plugins/constraints/src/main/res/values-lt-rLT/exam.xml
+++ b/plugins/constraints/src/main/res/values-lt-rLT/exam.xml
@@ -148,6 +148,7 @@
Nustačius 150% profilį, sistemos apskaičiuotas angliavandenių įsisavinimo laikas pailgėja
Nustačius 150% profilį, sistemos apskaičiuotas angliavandenių įsisavinimo laikas sutrumpėja
Nustačius 150% profilį, sistemos apskaičiuotas angliavandenių įsisavinimo laikas nepakinta
+ https://wiki.aaps.app/en/latest/Usage/COB-calculation.html#how-does-aaps-calculate-the-cob-value
AIO keičia nustatyta laikina valandinė bazė.
Padidinta laikina bazė nebus nustatyta, jei glikemija yra žemiau numatyto tikslo.
Jei ilgą laiką stebima neigiama AIO reikšmė ir nėra fizinio aktyvumo, tai rodo, kad Jūsų nustatymai yra per „agresyvūs“ ir Jums reikia mažiau insulino.
diff --git a/plugins/constraints/src/main/res/values-no-rNO/exam.xml b/plugins/constraints/src/main/res/values-nb-rNO/exam.xml
similarity index 99%
rename from plugins/constraints/src/main/res/values-no-rNO/exam.xml
rename to plugins/constraints/src/main/res/values-nb-rNO/exam.xml
index 21bb5132ca..8da0332af8 100644
--- a/plugins/constraints/src/main/res/values-no-rNO/exam.xml
+++ b/plugins/constraints/src/main/res/values-nb-rNO/exam.xml
@@ -190,20 +190,20 @@
IK vil være forskjellig hvis du regner en skive brød som 10g eller 12g.
IK faktor betyr: Hvor mange brødenheter som dekkes av 1E insulin?
https://wiki.aaps.app/en/latest/Getting-Started/FAQ.html#insulin-to-carb-ratio-ic-g-u
- Profil bytte
+ Profilbytte
Når du spesifiserer et profilbytte på 90%, hvilke svar er korrekte?
Basaldoser vil være 10% lavere.
ISF verdien vil være 10% høyere.
Verdien av KH ratio vil være 10 % lavere.
ISF og KH ratio er uendret.
https://wiki.aaps.app/en/latest/Usage/Profiles.html#profile-switch
- Profil bytte
+ Profilbytte
Når du spesifiserer et profilbytte på 120%, hvilke svar er korrekte?
Blodsukkermålet vil være 20% høyere.
Basaldoser vil være 20% høyere.
Blodsukkermålet vil være uforandret.
ISF vil være 20% høyere.
- Profil bytte
+ Profilbytte
Hvis du står opp 2 timer tidligere enn vanlig, hvordan forteller du AndroidAPS om endringen i døgnrytmen din?
Gjør et profilbytte med en tidsforskyvning på 2
Gjør et profilbytte med en tidsforskyvning på -2
diff --git a/plugins/constraints/src/main/res/values-no-rNO/objectives.xml b/plugins/constraints/src/main/res/values-nb-rNO/objectives.xml
similarity index 98%
rename from plugins/constraints/src/main/res/values-no-rNO/objectives.xml
rename to plugins/constraints/src/main/res/values-nb-rNO/objectives.xml
index 957e9d4277..291f461957 100644
--- a/plugins/constraints/src/main/res/values-no-rNO/objectives.xml
+++ b/plugins/constraints/src/main/res/values-nb-rNO/objectives.xml
@@ -9,7 +9,7 @@
Kontroller at BS er tilgjengelig i Nightscout og at insulindata fra pumpen lastes opp
Du har gjort et grunnleggende oppsett av AAPS økosystem. Nightscout (NS) er ikke nødvendig for at AAPS skal kunne kjøres, men det er svært nyttig for å lage rapporter eller gi innsyn i dine data. Det er ikke nødvendig å være tilkoblet NS hele tiden hvis du bruker NS kun for deg selv. Du kan lage innstillinger for å laste opp dine data til NS når du er tilkoblet hjemme wifi og spare batteri.
Starter med åpen loop
- Kjør i \"Åpen Loop\" modus i noen dager og aktiver flere temp basaler. Konfigurer og aktiver flere midlertidige og default temp BS mål (f.eks. for Aktivitet eller Hypo behandling)
+ Kjør i \"Åpen Loop\"-modus i noen dager og aktiver flere midlertidige basaler. Konfigurer og aktiver flere midlertidige mål og standard midlertidige mål (f.eks. for Aktivitet og Hypo)
Åpen loop kan brukes til anbefalinger hvis du ikke har en kompatibel pumpe eller hvis du ikke er klar til å kjøre i lukket loop.
Forstå din åpen loop, inkludert den temp basal anbefalingen
Ut ifra hva du har erfart og lært, avgjør hva din max basal skal være og still den inn i både pumpen og AAPS innstillinger
@@ -42,7 +42,7 @@
Angi profil 90% for 10 min (langt-trykk på profilnavn i Oversikt)
Simuler dusjing. Frakoble pumpen i 1t (langt trykk på Åpen Loop)
... og koble til igjen på samme måte
- Opprett egendefinerte midlertidige BS mål med 10 min varighet (langt-trykk på gjeldende mål)
+ Opprett egendefinerte midlertidige mål med 10 min varighet (langt-trykk på gjeldende mål)
I Konfigurasjonsverktøyet aktiverer du Hendelser plugin, og gjør det synlig og viser innholdet fra menyen i øverste linje
Vis innholdet i Loop plugin
Test skaleringsfunksjonen ved et langt trykk på BS grafen
diff --git a/plugins/constraints/src/main/res/values-no-rNO/strings.xml b/plugins/constraints/src/main/res/values-nb-rNO/strings.xml
similarity index 98%
rename from plugins/constraints/src/main/res/values-no-rNO/strings.xml
rename to plugins/constraints/src/main/res/values-nb-rNO/strings.xml
index 06ff898466..7e56ad8011 100644
--- a/plugins/constraints/src/main/res/values-no-rNO/strings.xml
+++ b/plugins/constraints/src/main/res/values-nb-rNO/strings.xml
@@ -45,7 +45,7 @@
Lukket loop aktivert
MÅL
Opplæringsprogram
- Ønsker du å starte læringsmåletpå nytt? Du vil miste fullførte trinn.
+ Ønsker du å starte læringsmålet på nytt? Du vil miste fullførte trinn.
Neste
Forrige
Nullstille ferdig-status
diff --git a/plugins/constraints/src/main/res/values-ru-rRU/exam.xml b/plugins/constraints/src/main/res/values-ru-rRU/exam.xml
index 8df6e9504a..56244ff327 100644
--- a/plugins/constraints/src/main/res/values-ru-rRU/exam.xml
+++ b/plugins/constraints/src/main/res/values-ru-rRU/exam.xml
@@ -148,6 +148,7 @@
Установка профиля на 150% увеличит расчетное время усвоения углеводов
Установка профиля на 150% уменьшит расчетное время усвоения углеводов
Установка профиля на 150% не повлияет на расчетное время усвоения углеводов
+ https://wiki.aaps.app/en/latest/Usage/COB-calculation.html#how-does-aaps-calculate-the-cob-value
На величину IOB влияют устанавливаемые ВБС.
Высокая ВБС не будет применяться, если уровень сахара в крови ниже целевого.
Отрицательный IOB в течение длительного периода при отсутствии физнагрузки указывает на то, что ваш профиль завышен и требуется снизить кол-во инсулина в настройках.
diff --git a/plugins/constraints/src/main/res/values-sk-rSK/exam.xml b/plugins/constraints/src/main/res/values-sk-rSK/exam.xml
index 9bb5b627a1..104796b05e 100644
--- a/plugins/constraints/src/main/res/values-sk-rSK/exam.xml
+++ b/plugins/constraints/src/main/res/values-sk-rSK/exam.xml
@@ -148,6 +148,7 @@
Nastavenie profilu na 150% spôsobí, že vypočítaná doba absorbcie sacharidov bude dlhšia
Nastavenie profilu na 150% spôsobí, že vypočítaná doba absorbcie sacharidov bude kratšia
Nastavenie profilu na 150% neovplyvní vypočítanú absorbciu sacharidov
+ https://wiki.aaps.app/cs/latest/Usage/COB-calculation.html#how-does-aaps-calculate-the-cob-value
Hodnota IOB je ovplyvnená vydanými dočasnými bazálmi.
Vysoký dočasný bazál nebude spustený, pokiaľ je Vaša glykémia nižšia, ako cieľ.
Negatívne IOB po značnú dobu bez cvičenia naznačuje, že váš profil je príliš \"silný\" a vo vašom profile je potrebného menej inzulínu.
diff --git a/plugins/insulin/src/main/res/values-no-rNO/strings.xml b/plugins/insulin/src/main/res/values-nb-rNO/strings.xml
similarity index 100%
rename from plugins/insulin/src/main/res/values-no-rNO/strings.xml
rename to plugins/insulin/src/main/res/values-nb-rNO/strings.xml
diff --git a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/wear/wearintegration/DataHandlerMobile.kt b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/wear/wearintegration/DataHandlerMobile.kt
index c45bd99c33..c55939ecbc 100644
--- a/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/wear/wearintegration/DataHandlerMobile.kt
+++ b/plugins/main/src/main/kotlin/app/aaps/plugins/main/general/wear/wearintegration/DataHandlerMobile.kt
@@ -495,11 +495,12 @@ class DataHandlerMobile @Inject constructor(
val message = rh.gs(R.string.quick_wizard_message, quickWizardEntry.buttonText(), wizard.calculatedTotalInsulin, quickWizardEntry.carbs()) +
"\n_____________\n" + wizard.explainShort()
+ lastBolusWizard = wizard
rxBus.send(
EventMobileToWear(
EventData.ConfirmAction(
rh.gs(app.aaps.core.ui.R.string.confirm).uppercase(), message,
- returnCommand = EventData.ActionBolusConfirmed(insulinAfterConstraints, carbsAfterConstraints)
+ returnCommand = EventData.ActionWizardConfirmed(wizard.timeStamp)
)
)
)
diff --git a/plugins/main/src/main/res/values-iw-rIL/strings.xml b/plugins/main/src/main/res/values-iw-rIL/strings.xml
index 0f883718d8..fdc69555a4 100644
--- a/plugins/main/src/main/res/values-iw-rIL/strings.xml
+++ b/plugins/main/src/main/res/values-iw-rIL/strings.xml
@@ -351,4 +351,5 @@
עד
טווח ברירת מחדל
מטרה
+ מינון: %1$.2f יח\'\\שעה (%2$.2f%%) \nמשך: %3$d דק\'
diff --git a/plugins/main/src/main/res/values-no-rNO/strings.xml b/plugins/main/src/main/res/values-nb-rNO/strings.xml
similarity index 91%
rename from plugins/main/src/main/res/values-no-rNO/strings.xml
rename to plugins/main/src/main/res/values-nb-rNO/strings.xml
index ed654f7943..6632e8430a 100644
--- a/plugins/main/src/main/res/values-no-rNO/strings.xml
+++ b/plugins/main/src/main/res/values-nb-rNO/strings.xml
@@ -137,10 +137,10 @@
Slette gjeldende profil?
Enheter:
Mangler profilnavn
- Feil i IK faktoren
+ Feil i IK-faktoren
Feil i basalverdiene
Feil i BS målverdier
- Feil i IF verdien
+ Feil i ISF-verdien
Noen av profilnavnene inneholder punktum.\nDette støttes ikke av NS.\nProfilen er ikke lastet opp til NS.
Ugyldig profil %1$s ikke akseptert fra NS
Visning
@@ -157,7 +157,7 @@
Handlinger
Hurtigknapper for rask tilgang til ofte brukte funksjoner
ACT
- MidlBasal
+ Midlertidig basal
Forlenget bolus
Avbryt forlenget bolus
Verktøy
@@ -170,8 +170,8 @@
Kanyle
Bruk av forlenget bolusfunksjon vil deaktivere lukket loop i perioden med forlenget bolus. Vil du virkelig dette?
kanyle alder
- patch pumpe alder
- Patch pumpe
+ pumpealder
+ Pumpe
Vis statusindikatorer på hjem-skjermen
Terskel for advarsel om alder på slangesett [h]
@@ -212,26 +212,26 @@
OpenAPS
Opplaster
BS data status
- Innstillinger for hurtigveiviser
+ Innstillinger for hurtigknapp
Hold skjermen påslått
Forhindre Android fra å slå av skjermen. Mobilen vil bruke mye batteri hvis den ikke kobles til strømledning.
Behandlinger
Antall karbohydrater som skal legges til når knappen trykkes
Mengde insulin som skal legges til når knappen trykkes
- Første økning hurtigknapp for insulin
- Andre økning hurtigknapp for insulin
- Tredje økning hurtigknapp for insulin
- Første økning hurtigknapp for karbohydrater
- Andre økning hurtigknapp for karbohydrater
- Tredje økning hurtigknapp for karbohydrater
+ Første økning knapp for insulin
+ Andre økning knapp for insulin
+ Tredje økning knapp for insulin
+ Første økning knapp for karbohydrater
+ Andre økning knapp for karbohydrater
+ Tredje økning knapp for karbohydrater
CGM
- Standard midl. mål
- spise snart varighet
- spise snart målverdi
- varighet for aktivitet
- målverdi ved aktivitet
- hypo varighet
- hypo målverdi
+ Standard midlertidig mål
+ Spise snart varighet (min)
+ Spise snart målverdi
+ Aktivitet varighet (min)
+ Aktivitet målverdi
+ Hypo varighet (min)
+ Hypo målverdi
Standardverdier for påfyll/prime
Knapp 1
Knapp 2
@@ -241,23 +241,23 @@
Lav verdi
Høy verdi
Korte navn i menyfaner
- Vis merknadsfelt i dialogvindu for behandlinger
+ Vis merknadsfelt i dialogvindu for boluskalkulator
Bolusveiviser utfører beregninger, men bare denne del av beregnet insulin leveres. Nyttig ved bruk av SMB-algoritmen.
Gi full bolus (100 %) dersom blodsukker er eldre enn
- Aktiver boluskalkulator
- Bruk en påminnelse om å spise senere isetdet for beregnet av kalkulator når blodsukker er høyt (\"pre-bolus\")
+ Aktiver bolusveileder
+ Bruk en påminnelse om å spise senere istedet for boluskalkulatorens resultat når blodsukker er høyt (\"pre-bolus\")
Aktiver superbolus i veiviser
- Aktiver superbolus-funksjonen i veiviseren. Ikke aktiver denne før du vet hvordan den fungerer. DEN KAN LEDE TIL EN OVERDOSERING AV INSULIN HVIS DEN BRUKES UKRITISK!
+ Aktiver superbolus-funksjonen i boluskalkulatoren. Ikke aktiver denne før du vet hvordan den fungerer. DEN KAN LEDE TIL EN OVERDOSERING AV INSULIN HVIS DEN BRUKES UKRITISK!
Aktiver boluspåminnelse
- Bruk påminnelse for å sette bolusdosen senere med veiviseren («post bolus»)
+ Bruk en påminnelse for å sette bolusdosen senere med boluskalkulatoren («post bolus»)
Kjør %s?
Prognoser
Behandlinger
Puls
Avvikskurve
- Aktivitet
- Blodsukkerpåvirkning
+ Insulinaktivitet
+ BS-påvirkning (BGI)
Sensitivitet
Avvik
Aktive KH (COB)
@@ -266,7 +266,7 @@
Absolutt insulinmengde
PROGN
BAS
- DEV
+ AVVIK
AKT
-BGI
ABS
@@ -274,7 +274,7 @@
BEH
HR
SENS
- Graf skala
+ Graf-skala
Graf
Opprinnelig visningstema
@@ -291,9 +291,9 @@
(Ingen klokke tilkoblet)
Pumpestatus
Loopstatus
- Kalkulator hurtigveiviser:\nInsulin: %1$.2fE\nKarbo: %2$dg
- Den valgte hurtigveiviseren er ikke tilgjengelig lenger, oppdater klokkeurskive
- Hurtigveiviser: %1$s\ninsulin: %2$.2fE\nKarbo: %3$dg
+ Boluskalkulator:\nInsulin: %1$.2fE\nKarbo: %2$dg
+ Den valgte hurtigknappen er ikke lenger tilgjengelig, oppdater klokkeflis
+ Hurtigknapp: %1$s\ninsulin: %2$.2fE\nKarbo: %3$dg
Ukjent forhåndsinnstilling midl. mål: %1$s
Avbryt gjeldende midl. mål?
Forskjellige enheter brukt på klokke og telefon!
@@ -307,7 +307,7 @@
Klokkeinnstillinger
Kontroller fra klokke
Sett midl. mål og angi behandlinger fra klokken.
- Beregninger inkludert i resultatet fra veiviseren:
+ Beregninger inkludert i resultatet fra kalkulator:
Generelle innstillinger
Varsle ved SMB
Vis SMB på klokken som en standard bolus.
@@ -332,7 +332,7 @@
g
t
Det er ikke angitt noen aktiv profil!
- Profil:\n\nTidsforskyving: %1$d$\nProsent: %2$d%%\"
+ Profil:\n\nTidsforskyving: %1$d\nProsent: %2$d%%
%1$.2fE %1$.0f%%
Ingen profil valgt
Bare bruk i APS-modus!
diff --git a/plugins/sensitivity/src/main/res/values-no-rNO/strings.xml b/plugins/sensitivity/src/main/res/values-nb-rNO/strings.xml
similarity index 100%
rename from plugins/sensitivity/src/main/res/values-no-rNO/strings.xml
rename to plugins/sensitivity/src/main/res/values-nb-rNO/strings.xml
diff --git a/plugins/smoothing/src/main/res/values-no-rNO/strings.xml b/plugins/smoothing/src/main/res/values-nb-rNO/strings.xml
similarity index 84%
rename from plugins/smoothing/src/main/res/values-no-rNO/strings.xml
rename to plugins/smoothing/src/main/res/values-nb-rNO/strings.xml
index 2ce352518a..f24cdc1d85 100644
--- a/plugins/smoothing/src/main/res/values-no-rNO/strings.xml
+++ b/plugins/smoothing/src/main/res/values-nb-rNO/strings.xml
@@ -2,7 +2,7 @@
UTJEVNING
Eksponentiell utjevning
- "Andre algoritme for eksponentiell utjevning"
+ "Andre ordens algoritme for eksponentiell utjevning"
Gjennomsnittlig utjevning
"Gjennomsnittlig utjevnings-algoritme, nyeste verdi påvirkes ikke"
Ingen utjevning
diff --git a/plugins/source/src/main/res/values-no-rNO/strings.xml b/plugins/source/src/main/res/values-nb-rNO/strings.xml
similarity index 94%
rename from plugins/source/src/main/res/values-no-rNO/strings.xml
rename to plugins/source/src/main/res/values-nb-rNO/strings.xml
index c719e2ad6b..7c3822f36a 100644
--- a/plugins/source/src/main/res/values-no-rNO/strings.xml
+++ b/plugins/source/src/main/res/values-nb-rNO/strings.xml
@@ -34,6 +34,5 @@
I xDrip+, velg 640G/Eversens som datakilde
Innstillinger for opplasting av BS
Logg sensorbytte til NS
- Opprett hendelse \"Senso bytte\" automatisk i NS ved start av sensoren
retning
diff --git a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/xdrip/DataSyncSelectorXdripImpl.kt b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/xdrip/DataSyncSelectorXdripImpl.kt
index 315a5e9957..5153dd95bf 100644
--- a/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/xdrip/DataSyncSelectorXdripImpl.kt
+++ b/plugins/sync/src/main/kotlin/app/aaps/plugins/sync/xdrip/DataSyncSelectorXdripImpl.kt
@@ -4,6 +4,9 @@ import app.aaps.core.interfaces.logging.AAPSLogger
import app.aaps.core.interfaces.logging.LTag
import app.aaps.core.interfaces.plugin.ActivePlugin
import app.aaps.core.interfaces.profile.ProfileFunction
+import app.aaps.core.interfaces.rx.bus.RxBus
+import app.aaps.core.interfaces.rx.events.EventNSClientNewLog
+import app.aaps.core.interfaces.rx.events.EventXdripNewLog
import app.aaps.core.interfaces.sharedPreferences.SP
import app.aaps.core.interfaces.sync.DataSyncSelector
import app.aaps.core.interfaces.sync.DataSyncSelectorXdrip
@@ -25,7 +28,8 @@ class DataSyncSelectorXdripImpl @Inject constructor(
private val profileFunction: ProfileFunction,
private val activePlugin: ActivePlugin,
private val xdripBroadcast: Lazy,
- private val appRepository: AppRepository
+ private val appRepository: AppRepository,
+ private val rxBus: RxBus
) : DataSyncSelectorXdrip {
class QueueCounter(
@@ -72,7 +76,17 @@ class DataSyncSelectorXdripImpl @Inject constructor(
override fun queueSize(): Long = queueCounter.size()
+ private var running = false
+ private val sync = Any()
+
override suspend fun doUpload() {
+ synchronized(sync) {
+ if (running) {
+ rxBus.send(EventXdripNewLog("RUN", "Already running"))
+ return
+ }
+ running = true
+ }
if (isEnabled) {
processChangedGlucoseValues()
processChangedBoluses()
@@ -96,6 +110,7 @@ class DataSyncSelectorXdripImpl @Inject constructor(
// not supported at the moment
//processChangedProfileStore()
}
+ running = false
}
override fun resetToNextFullSync() {
diff --git a/plugins/sync/src/main/res/values-no-rNO/oh_strings.xml b/plugins/sync/src/main/res/values-nb-rNO/oh_strings.xml
similarity index 100%
rename from plugins/sync/src/main/res/values-no-rNO/oh_strings.xml
rename to plugins/sync/src/main/res/values-nb-rNO/oh_strings.xml
diff --git a/plugins/sync/src/main/res/values-no-rNO/strings.xml b/plugins/sync/src/main/res/values-nb-rNO/strings.xml
similarity index 92%
rename from plugins/sync/src/main/res/values-no-rNO/strings.xml
rename to plugins/sync/src/main/res/values-nb-rNO/strings.xml
index f432e0bfa6..e91f3141de 100644
--- a/plugins/sync/src/main/res/values-no-rNO/strings.xml
+++ b/plugins/sync/src/main/res/values-nb-rNO/strings.xml
@@ -13,8 +13,8 @@
Opprett varslinger hvis det er nødvendig med karbohydrater
Opprett varslinger i Nightscout ved feil eller meldinger (også synlig i Careportal under Behandlinger)
Opprett Nightscout-meldinger ved behov for karbohydrater
- Synkroniserer dine data med Nightscout
- Synkroniserer dataene dine med Nightscout med v3 API
+ Synkroniserer dine data med Nightscout v1 API
+ Synkroniserer dine data med Nightscout v3 API
Blokkert på grunn av ladealternativer
Blokkert på grunn av tilkoblingsalternativer
Versjonen av Nightscout støttes ikke
@@ -51,20 +51,20 @@
Last opp data til NS
Hent lagrede profiler
Synkroniser profiler fra NS profileditor
- Motta midlertidige BS-mål
- Aksepter midlertidige mål angitt med NS eller NSClient
+ Motta midlertidige mål
+ Aksepter midlertidige mål angitt med NS eller AAPSClient
Motta profilbytter
Aksepter profilbytter som er angitt via NS eller NSClient
Motta APS offline hendelser
- Aksepter APS offline hendelser lagt inn gjennom NS eller NSClient
+ Aksepter APS offline hendelser lagt inn gjennom NS eller AAPSClient
Motta TBR og EB
Godta TBR og EB beregninger fra tilleggsmodul
Motta insulin
- Aksepter insulin angitt via NS eller NSClient (enhetene er ikke dosert, kun beregnet mot IOB)
+ Aksepter insulin angitt via NS eller AAPSClient (enhetene er ikke dosert, kun beregnet mot IOB)
Motta karbohydrater
- Aksepter karbohydrater angitt med NS eller NSClient
+ Aksepter karbohydrater angitt med NS eller AAPSClient
Motta behandlingshendelser
- Godta behandlingshendelser (kanyle, insulin, batteribytte osv.) som er lagt inn gjennom NS eller NSClient
+ Godta behandlingshendelser (kanyle, insulin, batteribytte osv.) som er lagt inn gjennom NS eller AAPSClient
Motta/tilbakefyll CGM data
Aksepter CGM data fra NS
Reduser opplastingshastighet
@@ -76,7 +76,7 @@
Logg app-start til NS
Kopiere NS innstillinger (hvis de eksisterer)?
Koble til websockets
- Aktivering vetyr: hurtigere oppdateringer, mottak av alarmer og kunngjøringer og høyere batteriforbruk som ligner v1. Alle andre opplastere til NS må bruke v3 protokoll.
+ Aktivering betyr: hurtigere oppdateringer, mottak av alarmer og kunngjøringer og høyere batteriforbruk som ligner v1 API. Alle andre opplastere til NS må bruke v3 API.
Ditt Tidepool brukernavn, normalt din e-postadresse
Brukernavn for innlogging
diff --git a/pump/combo/src/main/res/values-no-rNO/strings.xml b/pump/combo/src/main/res/values-nb-rNO/strings.xml
similarity index 100%
rename from pump/combo/src/main/res/values-no-rNO/strings.xml
rename to pump/combo/src/main/res/values-nb-rNO/strings.xml
diff --git a/pump/combo/src/test/java/info/nightscout/pump/combo/ComboPluginTest.kt b/pump/combo/src/test/java/info/nightscout/pump/combo/ComboPluginTest.kt
index 926af70f2b..ac537623b8 100644
--- a/pump/combo/src/test/java/info/nightscout/pump/combo/ComboPluginTest.kt
+++ b/pump/combo/src/test/java/info/nightscout/pump/combo/ComboPluginTest.kt
@@ -12,11 +12,11 @@ import app.aaps.core.interfaces.sharedPreferences.SP
import app.aaps.core.interfaces.ui.UiInteraction
import app.aaps.core.interfaces.utils.DateUtil
import app.aaps.shared.tests.TestBase
+import com.google.common.truth.Truth.assertThat
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.pump.combo.ruffyscripter.RuffyScripter
import info.nightscout.pump.combo.ruffyscripter.history.Bolus
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mock
@@ -56,8 +56,8 @@ class ComboPluginTest : TestBase() {
comboPlugin.setPluginEnabled(PluginType.PUMP, true)
comboPlugin.setValidBasalRateProfileSelectedOnPump(false)
val c = comboPlugin.isLoopInvocationAllowed(ConstraintObject(true, aapsLogger))
- Assertions.assertEquals("Combo: No valid basal rate read from pump", c.getReasons())
- Assertions.assertEquals(false, c.value())
+ assertThat(c.getReasons()).isEqualTo("Combo: No valid basal rate read from pump")
+ assertThat(c.value()).isFalse()
comboPlugin.setPluginEnabled(PluginType.PUMP, false)
}
@@ -66,18 +66,16 @@ class ComboPluginTest : TestBase() {
val now = System.currentTimeMillis()
val pumpTimestamp = now - now % 1000
// same timestamp, different bolus leads to different fake timestamp
- Assertions.assertNotEquals(
- comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp, 0.1, true)),
+ assertThat(
comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp, 0.3, true))
- )
+ ).isNotEqualTo(comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp, 0.1, true)))
// different timestamp, same bolus leads to different fake timestamp
- Assertions.assertNotEquals(
- comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp, 0.3, true)),
+ assertThat(
comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp + 60 * 1000, 0.3, true))
- )
+ ).isNotEqualTo(comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp, 0.3, true)))
// generated timestamp has second-precision
val bolus = Bolus(pumpTimestamp, 0.2, true)
val calculatedTimestamp = comboPlugin.generatePumpBolusId(bolus)
- Assertions.assertEquals(calculatedTimestamp, calculatedTimestamp - calculatedTimestamp % 1000)
+ assertThat(calculatedTimestamp - calculatedTimestamp % 1000).isEqualTo(calculatedTimestamp)
}
-}
\ No newline at end of file
+}
diff --git a/pump/combov2/src/main/res/values-no-rNO/strings.xml b/pump/combov2/src/main/res/values-nb-rNO/strings.xml
similarity index 100%
rename from pump/combov2/src/main/res/values-no-rNO/strings.xml
rename to pump/combov2/src/main/res/values-nb-rNO/strings.xml
diff --git a/pump/dana/src/main/res/values-no-rNO/strings.xml b/pump/dana/src/main/res/values-nb-rNO/strings.xml
similarity index 100%
rename from pump/dana/src/main/res/values-no-rNO/strings.xml
rename to pump/dana/src/main/res/values-nb-rNO/strings.xml
diff --git a/pump/danar/src/main/res/values-no-rNO/strings.xml b/pump/danar/src/main/res/values-nb-rNO/strings.xml
similarity index 100%
rename from pump/danar/src/main/res/values-no-rNO/strings.xml
rename to pump/danar/src/main/res/values-nb-rNO/strings.xml
diff --git a/pump/diaconn/src/main/res/values-no-rNO/strings.xml b/pump/diaconn/src/main/res/values-nb-rNO/strings.xml
similarity index 99%
rename from pump/diaconn/src/main/res/values-no-rNO/strings.xml
rename to pump/diaconn/src/main/res/values-nb-rNO/strings.xml
index e3ee2e76e9..23b32d57b3 100644
--- a/pump/diaconn/src/main/res/values-no-rNO/strings.xml
+++ b/pump/diaconn/src/main/res/values-nb-rNO/strings.xml
@@ -3,7 +3,7 @@
Slett sammenkobling
Ingen enheter er tilgjengelige
Diaconn pumpe sammenkobling
- Pumpe feil
+ Pumpefeil
Alarmer
Basal timer
Boluser
@@ -33,7 +33,7 @@
Diaconn G8
Diaconn G8
Max bolus nådd
- Kommando feil
+ Kommandofeil
Hastighetsfeil
Insulingrense nådd
Forespurt: %1$.2fE Levert: %2$.2fE Feilkode: %3$s
diff --git a/pump/eopatch/src/main/res/values-no-rNO/strings.xml b/pump/eopatch/src/main/res/values-nb-rNO/strings.xml
similarity index 99%
rename from pump/eopatch/src/main/res/values-no-rNO/strings.xml
rename to pump/eopatch/src/main/res/values-nb-rNO/strings.xml
index 79d285475f..4f4d1f0686 100644
--- a/pump/eopatch/src/main/res/values-no-rNO/strings.xml
+++ b/pump/eopatch/src/main/res/values-nb-rNO/strings.xml
@@ -86,7 +86,7 @@
Kontrollerer Patch kommunikasjon…
Flytt smartenheten din nærmere Patch.
Gå til en annen lokasjon og prøv på nytt.
- Kommunikasjons feil
+ Kommunikasjonsfeil
Kommunikasjon vellykket
Sammenkoblet med Patch.
Avbryt paringen
diff --git a/pump/eopatch/src/main/res/values-no-rNO/strings_alarm.xml b/pump/eopatch/src/main/res/values-nb-rNO/strings_alarm.xml
similarity index 100%
rename from pump/eopatch/src/main/res/values-no-rNO/strings_alarm.xml
rename to pump/eopatch/src/main/res/values-nb-rNO/strings_alarm.xml
diff --git a/pump/medtronic/src/main/res/values-no-rNO/strings.xml b/pump/medtronic/src/main/res/values-nb-rNO/strings.xml
similarity index 99%
rename from pump/medtronic/src/main/res/values-no-rNO/strings.xml
rename to pump/medtronic/src/main/res/values-nb-rNO/strings.xml
index fa3221b358..7a7ffa8595 100644
--- a/pump/medtronic/src/main/res/values-no-rNO/strings.xml
+++ b/pump/medtronic/src/main/res/values-nb-rNO/strings.xml
@@ -73,7 +73,7 @@
Angi basal profil
Henter Temp Basal
Angi Temp Basal
- Avbryt temp basal
+ Avbryt midlertidig basal
Angi Bolus
Oppdater status insulinvolum
Pumpe utilgjengelig
diff --git a/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.kt b/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.kt
index 9d3cd74fef..dc86e8aefc 100644
--- a/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.kt
+++ b/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/MedtronicPumpHistoryDecoderUTest.kt
@@ -1,13 +1,13 @@
package info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump
import app.aaps.core.interfaces.ui.UiInteraction
+import com.google.common.truth.Truth.assertThat
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicTestBase
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.RawHistoryPage
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
import info.nightscout.pump.common.utils.ByteUtil
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mock
@@ -162,7 +162,7 @@ class MedtronicPumpHistoryDecoderUTest : MedtronicTestBase() {
"5A 0F 20 F4 0C 03 15 19 11 00 17 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1A 11 00 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 01 12 12 00 25 DE 2D 43 15 01 50 50 00 26 EA 2D 43 15 01 4B 4B 00 2C C9 34 43 15 62 00 2F CB 17 03 15 01 33 33 00 16 DE 37 43 15 07 00 00 07 FE 23 95 6D 23 95 0A 08 00 2B 00 00 00 00 07 FE 03 8E 2C 04 70 38 00 00 04 70 38 00 00 00 00 00 00 04 70 64 06 00 00 00 06 08 00 2B 00 00 00 2C A0 2F E3 01 04 15 33 00 2F E7 04 44 15 00 16 03 2F E7 04 44 15 33 28 3B C2 06 44 15 00 16 01 3B C2 06 44 15 08 08 17 DB 0B 44 15 00 26 00 06 26 00 0C 26 00 12 28 00 18 26 00 1E 26 00 24 24 00 2A 26 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 18 17 DB 0B 44 15 00 26 00 02 26 00 04 26 00 06 24 00 08 24 00 0A 24 00 0C 26 00 0E 26 00 10 26 00 12 28 00 14 28 00 16 28 00 18 26 00 1A 26 00 1C 26 00 1E 26 00 20 26 00 22 26 00 24 24 00 26 24 00 28 24 00 2A 26 00 2C 26 00 2E 26 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 45 45 00 28 E9 2B 44 15 19 00 00 C1 0D 04 15 1A 00 15 C3 0D 04 15 1A 01 33 C3 0D 04 15 01 28 28 00 07 CC 2E 44 15 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 14 2D",
MedtronicDeviceType.Medtronic_522_722
)
- Assertions.assertEquals(20, pumpHistoryEntries.size.toLong())
+ assertThat(pumpHistoryEntries).hasSize(20)
}
@Test @Throws(Exception::class) fun historyProblem_423_duzy78() {
@@ -170,7 +170,7 @@ class MedtronicPumpHistoryDecoderUTest : MedtronicTestBase() {
"16 00 08 D0 0E 51 15 33 60 0A D0 0E 51 15 00 16 01 0A D0 0E 51 15 33 00 07 DF 0E 51 15 00 16 00 07 DF 0E 51 15 33 6C 09 DF 0E 51 15 00 16 01 09 DF 0E 51 15 33 00 25 ED 0E 51 15 00 16 00 25 ED 0E 51 15 33 2C 27 ED 0E 51 15 00 16 01 27 ED 0E 51 15 33 00 07 F4 0E 51 15 00 16 00 07 F4 0E 51 15 33 00 09 F4 0E 51 15 00 16 01 09 F4 0E 51 15 33 2C 25 D5 0F 51 15 00 16 01 25 D5 0F 51 15 01 3C 3C 00 30 D5 4F 51 15 33 2C 25 F7 0F 51 15 00 16 01 25 F7 0F 51 15 33 00 07 C6 10 51 15 00 16 00 07 C6 10 51 15 33 30 09 C6 10 51 15 00 16 01 09 C6 10 51 15 33 30 25 E8 10 51 15 00 16 01 25 E8 10 51 15 33 30 24 CF 11 51 15 00 16 01 24 CF 11 51 15 33 00 23 E4 11 51 15 00 16 00 23 E4 11 51 15 33 3C 25 E4 11 51 15 00 16 01 25 E4 11 51 15 33 00 23 E8 11 51 15 00 16 00 23 E8 11 51 15 33 4A 25 E8 11 51 15 00 16 01 25 E8 11 51 15 33 00 19 EE 11 51 15 00 16 00 19 EE 11 51 15 33 30 1B EE 11 51 15 00 16 01 1B EE 11 51 15 33 00 23 F2 11 51 15 00 16 00 23 F2 11 51 15 33 3E 25 F2 11 51 15 00 16 01 25 F2 11 51 15 33 00 24 C0 12 51 15 00 16 00 24 C0 12 51 15 33 5E 25 C0 12 51 15 00 16 01 25 C0 12 51 15 33 00 23 CF 12 51 15 00 16 00 23 CF 12 51 15 33 64 25 CF 12 51 15 00 16 01 25 CF 12 51 15 33 00 23 D9 12 51 15 00 16 00 23 D9 12 51 15 33 6A 25 D9 12 51 15 00 16 01 25 D9 12 51 15 33 00 23 E9 12 51 15 00 16 00 23 E9 12 51 15 33 30 25 E9 12 51 15 00 16 01 25 E9 12 51 15 01 16 16 00 10 C2 53 51 15 33 30 24 CF 13 51 15 00 16 01 24 CF 13 51 15 33 30 04 EE 13 51 15 00 16 01 04 EE 13 51 15 01 14 14 00 3B F0 53 51 15 33 00 22 C0 14 51 15 00 16 00 22 C0 14 51 15 33 22 24 C0 14 51 15 00 16 01 24 C0 14 51 15 33 22 03 DF 14 51 15 00 16 01 03 DF 14 51 15 1E 00 37 E1 14 11 15 1F 00 01 EE 14 11 15 33 22 03 C6 15 51 15 00 16 01 03 C6 15 51 15 33 00 20 D9 15 51 15 00 16 00 20 D9 15 51 15 33 34 22 D9 15 51 15 00 16 01 22 D9 15 51 15 39 14 0E DF 35 71 15 83 92 40 01 0B 0B 00 37 E0 55 51 15 33 00 21 E3 15 51 15 00 16 00 21 E3 15 51 15 33 22 22 E3 15 51 15 00 16 01 22 E3 15 51 15 33 00 21 E8 15 51 15 00 16 00 21 E8 15 51 15 33 30 23 E8 15 51 15 00 16 01 23 E8 15 51 15 33 00 20 ED 15 51 15 00 16 00 20 ED 15 51 15 33 22 22 ED 15 51 15 00 16 01 22 ED 15 51 15 33 00 03 F8 15 51 15 00 16 00 03 F8 15 51 15 33 32 05 F8 15 51 15 00 16 01 05 F8 15 51 15 33 00 01 CB 16 51 15 00 16 00 01 CB 16 51 15 33 20 03 CB 16 51 15 00 16 01 03 CB 16 51 15 33 2A 20 ED 16 51 15 00 16 01 20 ED 16 51 15 33 00 02 F8 16 51 15 00 16 00 02 F8 16 51 15 33 2C 04 F8 16 51 15 00 16 01 04 F8 16 51 15 33 00 1F CA 17 51 15 00 16 00 1F CA 17 51 15 33 34 21 CA 17 51 15 00 16 01 21 CA 17 51 15 33 00 1F D4 17 51 15 00 16 00 1F D4 17 51 15 33 38 21 D4 17 51 15 00 16 01 21 D4 17 51 15 33 00 15 EE 17 51 15 00 16 00 15 EE 17 51 15 33 42 17 EE 17 51 15 00 16 01 17 EE 17 51 15 07 00 00 08 0A 31 95 6C 31 95 05 00 A1 A1 A1 01 00 00 08 0A 04 8E 39 03 7C 2B 00 00 03 7C 2B 00 00 00 00 00 00 03 7C 64 07 00 00 00 07 33 00 05 C1 00 52 15 00 16 00 05 C1 00 52 15 33 50 07 C1 00 52 15 00 16 01 07 C1 00 52 15 33 00 01 CB 00 52 15 00 16 00 01 CB 00 52 15 33 26 03 CB 00 52 15 00 16 01 03 CB 00 52 15 33 00 1E DE 00 52 15 00 00 00 8F 0E",
MedtronicDeviceType.Medtronic_515_715
)
- Assertions.assertEquals(131, pumpHistoryEntries.size.toLong())
+ assertThat(pumpHistoryEntries).hasSize(131)
}
@Test @Throws(Exception::class) fun historyProblem_476_OpossumGit() {
@@ -178,7 +178,7 @@ class MedtronicPumpHistoryDecoderUTest : MedtronicTestBase() {
"08 07 50 05 0D 4D 15 00 18 00 08 14 00 0E 10 00 14 08 00 1E 12 00 26 16 00 2B 1A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 18 50 05 0D 4D 15 00 18 00 02 18 00 04 18 00 06 18 00 08 14 00 0A 14 00 0C 14 00 0E 10 00 10 10 00 12 10 00 14 08 00 16 08 00 18 08 00 1A 08 00 1C 08 00 1E 14 00 20 14 00 22 14 00 24 14 00 26 16 00 28 16 00 2A 16 00 2C 1C 00 2E 1C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 04 04 00 44 09 4D 4D 15 33 06 57 15 0D 4D 15 00 16 01 57 15 0D 4D 15 33 00 77 15 0D 4D 15 00 16 00 77 15 0D 4D 15 33 00 5D 16 0D 4D 15 00 16 04 5D 16 0D 4D 15 33 00 61 1A 0D 4D 15 00 16 00 61 1A 0D 4D 15 5D 00 5E 31 0D 0D 15 1A 00 6E 31 0D 0D 15 06 03 04 D2 6E 31 6D 0D 15 0C 03 11 40 00 01 05 64 01 13 40 00 01 05 17 00 0A 41 00 01 05 18 00 40 39 15 0D 15 21 00 53 04 16 0D 15 03 00 00 00 58 57 09 36 0D 15 5D 01 78 0A 16 0D 15 64 01 78 0A 16 8D 15 2C 68 78 0A 16 8D 15 24 3C 78 0A 16 8D 15 63 02 78 0A 16 8D 15 1B 12 78 0A 16 8D 15 65 61 78 0A 16 8D 15 61 00 78 0A 16 8D 15 32 0E 78 0A 16 8D 15 66 00 78 0A 16 8D 15 3C 01 78 0A 16 8D 15 3D 88 32 93 00 00 00 3E 00 00 00 00 00 00 26 01 78 0A 16 8D 15 27 01 B2 08 00 00 00 28 00 00 00 00 00 00 60 00 78 0A 16 4D 15 23 00 78 0A 16 8D 15 5E 01 78 0A 16 8D 15 2D 01 78 0A 16 8D 15 5A 0F 78 0A 16 8D 15 49 13 00 07 12 0A 1E 0B 2A 0A 00 00 00 00 00 00 00 00 00 23 08 27 2C 23 00 00 00 00 00 00 00 00 00 00 00 32 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 13 00 07 12 0A 1E 0B 2A 0A 00 00 00 00 00 00 00 00 00 23 08 27 2C 23 00 00 00 00 00 00 00 00 00 00 00 32 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 22 62 00 78 0A 16 8D 15 5F 51 78 0A 16 8D 15 4F 00 78 0A 16 8D 15 40 01 00 6F 1C 16 1E 00 3C 14 00 1E 3C 1F 15 70 40 01 00 6F 1C 16 1E 00 3C 14 00 1E 3C 1F 15 70 08 18 78 0A 16 8D 15 00 18 00 02 18 00 04 18 00 06 18 00 08 14 00 0A 14 00 0C 14 00 0E 10 00 10 10 00 12 10 00 14 08 00 16 08 00 18 08 00 1A 08 00 1C 08 00 1E 14 00 20 14 00 22 14 00 24 14 00 26 16 00 28 16 00 2A 16 00 2C 1C 00 2E 1C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 D6 06",
MedtronicDeviceType.Medtronic_522_722
)
- Assertions.assertEquals(41, pumpHistoryEntries.size.toLong())
+ assertThat(pumpHistoryEntries).hasSize(41)
}
@Throws(Exception::class)
diff --git a/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryEntryUTest.kt b/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryEntryUTest.kt
index 0eb9612fcf..8b07c7dc2c 100644
--- a/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryEntryUTest.kt
+++ b/pump/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/history/pump/PumpHistoryEntryUTest.kt
@@ -1,7 +1,7 @@
package info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicTestBase
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.Test
/**
@@ -10,12 +10,12 @@ import org.junit.jupiter.api.Test
*/
class PumpHistoryEntryUTest : MedtronicTestBase() {
- @Test
+ @Test
fun checkIsAfter() {
val dateObject = 20191010000000L
val queryObject = 20191009000000L
val phe = PumpHistoryEntry()
phe.atechDateTime = dateObject
- Assertions.assertTrue(phe.isAfter(queryObject))
+ assertThat(phe.isAfter(queryObject)).isTrue()
}
}
diff --git a/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/MedtrumPlugin.kt b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/MedtrumPlugin.kt
index e40762b526..2adb563031 100644
--- a/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/MedtrumPlugin.kt
+++ b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/MedtrumPlugin.kt
@@ -11,6 +11,7 @@ import android.text.format.DateFormat
import androidx.preference.EditTextPreference
import androidx.preference.ListPreference
import androidx.preference.PreferenceFragmentCompat
+import androidx.preference.SwitchPreference
import app.aaps.core.interfaces.constraints.ConstraintsChecker
import app.aaps.core.interfaces.logging.AAPSLogger
import app.aaps.core.interfaces.logging.LTag
@@ -39,6 +40,7 @@ import app.aaps.core.interfaces.rx.bus.RxBus
import app.aaps.core.interfaces.rx.events.EventAppExit
import app.aaps.core.interfaces.rx.events.EventDismissNotification
import app.aaps.core.interfaces.rx.events.EventOverviewBolusProgress
+import app.aaps.core.interfaces.sharedPreferences.SP
import app.aaps.core.interfaces.ui.UiInteraction
import app.aaps.core.interfaces.utils.DateUtil
import app.aaps.core.interfaces.utils.DecimalFormatter
@@ -67,6 +69,7 @@ import kotlin.math.abs
aapsLogger: AAPSLogger,
rh: ResourceHelper,
commandQueue: CommandQueue,
+ private val sp: SP,
private val constraintChecker: ConstraintsChecker,
private val aapsSchedulers: AapsSchedulers,
private val rxBus: RxBus,
@@ -102,6 +105,9 @@ import kotlin.math.abs
.toObservable(EventAppExit::class.java)
.observeOn(aapsSchedulers.io)
.subscribe({ context.unbindService(mConnection) }, fabricPrivacy::logException)
+
+ // Force enable pump unreachable alert due to some failure modes of Medtrum pump
+ sp.putBoolean(app.aaps.core.utils.R.string.key_enable_pump_unreachable_alert, true)
}
override fun onStop() {
@@ -134,6 +140,7 @@ import kotlin.math.abs
preprocessSerialSettings(preferenceFragment)
preprocessAlarmSettings(preferenceFragment)
preprocessMaxInsulinSettings(preferenceFragment)
+ preprocessConnectionAlertSettings(preferenceFragment)
}
private fun preprocessSerialSettings(preferenceFragment: PreferenceFragmentCompat) {
@@ -241,6 +248,21 @@ import kotlin.math.abs
}
}
+ private fun preprocessConnectionAlertSettings(preferenceFragment: PreferenceFragmentCompat) {
+ val unreachableAlertSetting = preferenceFragment.findPreference(rh.gs(app.aaps.core.utils.R.string.key_enable_pump_unreachable_alert))
+ val unreachableThresholdSetting = preferenceFragment.findPreference(rh.gs(app.aaps.core.utils.R.string.key_pump_unreachable_threshold_minutes))
+
+ unreachableAlertSetting?.apply {
+ isSelectable = false
+ summary = rh.gs(R.string.enable_pump_unreachable_alert_summary)
+ }
+
+ unreachableThresholdSetting?.apply {
+ val currentValue = text
+ summary = "${rh.gs(R.string.pump_unreachable_threshold_minutes_summary)}\n${currentValue}"
+ }
+ }
+
override fun isInitialized(): Boolean {
return medtrumPump.pumpState > MedtrumPumpState.EJECTED && medtrumPump.pumpState < MedtrumPumpState.STOPPED
}
diff --git a/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/MedtrumPump.kt b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/MedtrumPump.kt
index 48cba7b7a9..4a7f99e566 100644
--- a/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/MedtrumPump.kt
+++ b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/MedtrumPump.kt
@@ -71,6 +71,15 @@ class MedtrumPump @Inject constructor(
_activeAlarms = value
}
+ // New pump warnings
+ private val _pumpWarning = MutableStateFlow(AlarmState.NONE)
+ val pumpWarningFlow: StateFlow = _pumpWarning
+ var pumpWarning: AlarmState
+ get() = _pumpWarning.value
+ set(value) {
+ _pumpWarning.value = value
+ }
+
// Prime progress as state flow
private val _primeProgress = MutableStateFlow(0)
val primeProgressFlow: StateFlow = _primeProgress
diff --git a/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/comm/ReadDataPacket.kt b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/comm/ReadDataPacket.kt
index e091cb8f73..9eb2e01e89 100644
--- a/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/comm/ReadDataPacket.kt
+++ b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/comm/ReadDataPacket.kt
@@ -1,12 +1,32 @@
package info.nightscout.pump.medtrum.comm
+import CrcUtils.calcCrc8
+
class ReadDataPacket(data: ByteArray) {
private var totalData = data.copyOfRange(0, data.size - 1) // Strip crc
+ private var failed = false
private var dataSize: Byte = data[0]
+ private var sequenceNumber: Byte = data[3]
+
+ init {
+ val crcInitialChunk = calcCrc8(data.copyOfRange(0, data.size - 1), data.size - 1)
+
+ if (crcInitialChunk != data[data.size - 1]) {
+ failed = true
+ }
+ }
fun addData(newData: ByteArray) {
totalData += newData.copyOfRange(4, newData.size - 1) // Strip header and crc
+ sequenceNumber++
+ val crcNewChunk = calcCrc8(newData.copyOfRange(0, newData.size - 1), newData.size - 1)
+ if (crcNewChunk != newData[newData.size - 1]) {
+ failed = true
+ }
+ if (sequenceNumber != newData[3]) {
+ failed = true
+ }
}
fun allDataReceived(): Boolean {
@@ -16,4 +36,8 @@ class ReadDataPacket(data: ByteArray) {
fun getData(): ByteArray {
return totalData
}
+
+ fun failed(): Boolean {
+ return failed
+ }
}
diff --git a/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/comm/WriteCommandPackets.kt b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/comm/WriteCommandPackets.kt
index 31655f3ed9..5d3974e133 100644
--- a/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/comm/WriteCommandPackets.kt
+++ b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/comm/WriteCommandPackets.kt
@@ -1,8 +1,8 @@
package info.nightscout.pump.medtrum.comm
-class WriteCommandPackets(data: ByteArray, sequenceNumber: Int) {
+import CrcUtils.calcCrc8
- private val CRC_8_TABLE: IntArray = intArrayOf(0, 155, 173, 54, 193, 90, 108, 247, 25, 130, 180, 47, 216, 67, 117, 238, 50, 169, 159, 4, 243, 104, 94, 197, 43, 176, 134, 29, 234, 113, 71, 220, 100, 255, 201, 82, 165, 62, 8, 147, 125, 230, 208, 75, 188, 39, 17, 138, 86, 205, 251, 96, 151, 12, 58, 161, 79, 212, 226, 121, 142, 21, 35, 184, 200, 83, 101, 254, 9, 146, 164, 63, 209, 74, 124, 231, 16, 139, 189, 38, 250, 97, 87, 204, 59, 160, 150, 13, 227, 120, 78, 213, 34, 185, 143, 20, 172, 55, 1, 154, 109, 246, 192, 91, 181, 46, 24, 131, 116, 239, 217, 66, 158, 5, 51, 168, 95, 196, 242, 105, 135, 28, 42, 177, 70, 221, 235, 112, 11, 144, 166, 61, 202, 81, 103, 252, 18, 137, 191, 36, 211, 72, 126, 229, 57, 162, 148, 15, 248, 99, 85, 206, 32, 187, 141, 22, 225, 122, 76, 215, 111, 244, 194, 89, 174, 53, 3, 152, 118, 237, 219, 64, 183, 44, 26, 129, 93, 198, 240, 107, 156, 7, 49, 170, 68, 223, 233, 114, 133, 30, 40, 179, 195, 88, 110, 245, 2, 153, 175, 52, 218, 65, 119, 236, 27, 128, 182, 45, 241, 106, 92, 199, 48, 171, 157, 6, 232, 115, 69, 222, 41, 178, 132, 31, 167, 60, 10, 145, 102, 253, 203, 80, 190, 37, 19, 136, 127, 228, 210, 73, 149, 14, 56, 163, 84, 207, 249, 98, 140, 23, 33, 186, 77, 214, 224, 123)
+class WriteCommandPackets(data: ByteArray, sequenceNumber: Int) {
private val packages = mutableListOf()
private var index = 0
@@ -17,7 +17,7 @@ class WriteCommandPackets(data: ByteArray, sequenceNumber: Int) {
)
var tmp: ByteArray = header + data.copyOfRange(1, data.size)
- val totalCommand: ByteArray = tmp + calcCrc8(tmp, tmp.size).toByte()
+ val totalCommand: ByteArray = tmp + calcCrc8(tmp, tmp.size)
if ((totalCommand.size - header.size) <= 15) {
packages.add(totalCommand + 0.toByte())
@@ -28,7 +28,7 @@ class WriteCommandPackets(data: ByteArray, sequenceNumber: Int) {
while (remainingCommand.size > 15) {
header[3] = pkgIndex.toByte()
tmp = header + remainingCommand.copyOfRange(0, 15)
- packages.add(tmp + calcCrc8(tmp, tmp.size).toByte())
+ packages.add(tmp + calcCrc8(tmp, tmp.size))
remainingCommand = remainingCommand.copyOfRange(15, remainingCommand.size)
pkgIndex = (pkgIndex + 1) % 256
@@ -37,7 +37,7 @@ class WriteCommandPackets(data: ByteArray, sequenceNumber: Int) {
// Add last package
header[3] = pkgIndex.toByte()
tmp = header + remainingCommand
- packages.add(tmp + calcCrc8(tmp, tmp.size).toByte())
+ packages.add(tmp + calcCrc8(tmp, tmp.size))
}
}
@@ -53,12 +53,4 @@ class WriteCommandPackets(data: ByteArray, sequenceNumber: Int) {
fun allPacketsConsumed(): Boolean {
return index >= packages.size
}
-
- private fun calcCrc8(value: ByteArray, size: Int): Int {
- var crc8 = 0
- for (i in 0 until size) {
- crc8 = CRC_8_TABLE[(value[i].toInt() and 255) xor (crc8 and 255)] and 255
- }
- return crc8
- }
}
diff --git a/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/comm/packets/NotificationPacket.kt b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/comm/packets/NotificationPacket.kt
index cc3d1c9178..929f574165 100644
--- a/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/comm/packets/NotificationPacket.kt
+++ b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/comm/packets/NotificationPacket.kt
@@ -53,14 +53,53 @@ class NotificationPacket(val injector: HasAndroidInjector) {
private const val MASK_STORAGE = 0x100
private const val MASK_ALARM = 0x200
private const val MASK_AGE = 0x400
- private const val MASK_UNKNOWN_1 = 0x800
+ private const val MASK_MAGNETO_PLACE = 0x800
private const val MASK_UNUSED_CGM = 0x1000
private const val MASK_UNUSED_COMMAND_CONFIRM = 0x2000
private const val MASK_UNUSED_AUTO_STATUS = 0x4000
private const val MASK_UNUSED_LEGACY = 0x8000
+
+ private const val SIZE_FIELD_MASK = 2
+ private const val SIZE_SUSPEND = 4
+ private const val SIZE_NORMAL_BOLUS = 3
+ private const val SIZE_EXTENDED_BOLUS = 3
+ private const val SIZE_BASAL = 12
+ private const val SIZE_SETUP = 1
+ private const val SIZE_RESERVOIR = 2
+ private const val SIZE_START_TIME = 4
+ private const val SIZE_BATTERY = 3
+ private const val SIZE_STORAGE = 4
+ private const val SIZE_ALARM = 4
+ private const val SIZE_AGE = 4
+ private const val SIZE_MAGNETO_PLACE = 2
+ private const val SIZE_UNUSED_CGM = 5
+ private const val SIZE_UNUSED_COMMAND_CONFIRM = 2
+ private const val SIZE_UNUSED_AUTO_STATUS = 2
+ private const val SIZE_UNUSED_LEGACY = 2
}
+ val maskHandlers: Map Int> = mapOf(
+ MASK_SUSPEND to ::handleSuspend,
+ MASK_NORMAL_BOLUS to ::handleNormalBolus,
+ MASK_EXTENDED_BOLUS to ::handleExtendedBolus,
+ MASK_BASAL to ::handleBasal,
+ MASK_SETUP to ::handleSetup,
+ MASK_RESERVOIR to ::handleReservoir,
+ MASK_START_TIME to ::handleStartTime,
+ MASK_BATTERY to ::handleBattery,
+ MASK_STORAGE to ::handleStorage,
+ MASK_ALARM to ::handleAlarm,
+ MASK_AGE to ::handleAge,
+ MASK_MAGNETO_PLACE to ::handleUnknown1,
+ MASK_UNUSED_CGM to ::handleUnusedCGM,
+ MASK_UNUSED_COMMAND_CONFIRM to ::handleUnusedCommandConfirm,
+ MASK_UNUSED_AUTO_STATUS to ::handleUnusedAutoStatus,
+ MASK_UNUSED_LEGACY to ::handleUnusedLegacy
+ )
+
+ var newPatchStartTime = 0L
+
init {
injector.androidInjector().inject(this)
}
@@ -74,7 +113,7 @@ class NotificationPacket(val injector: HasAndroidInjector) {
medtrumPump.pumpState = state
}
- if (notification.size > NOTIF_STATE_END) {
+ if (notification.size > NOTIF_STATE_END + SIZE_FIELD_MASK) {
handleMaskedMessage(notification.copyOfRange(NOTIF_STATE_END, notification.size))
}
}
@@ -82,160 +121,219 @@ class NotificationPacket(val injector: HasAndroidInjector) {
/**
* Handle a message with a field mask, can be used by other packets as well
*/
- fun handleMaskedMessage(data: ByteArray) {
+ fun handleMaskedMessage(data: ByteArray): Boolean {
val fieldMask = data.copyOfRange(0, 2).toInt()
var offset = 2
- var newPatchStartTime: Long? = null
+
+ val expectedLength = calculateExpectedLengthBasedOnFieldMask(fieldMask)
+ if (data.size < expectedLength) {
+ aapsLogger.error(LTag.PUMPCOMM, "Incorrect message length. Expected at least $expectedLength bytes.")
+ return false
+ }
aapsLogger.debug(LTag.PUMPCOMM, "Message field mask: $fieldMask")
- if (fieldMask and MASK_SUSPEND != 0) {
- aapsLogger.debug(LTag.PUMPCOMM, "Suspend notification received")
- medtrumPump.suspendTime = MedtrumTimeUtil().convertPumpTimeToSystemTimeMillis(data.copyOfRange(offset, offset + 4).toLong())
- aapsLogger.debug(LTag.PUMPCOMM, "Suspend time: ${medtrumPump.suspendTime}")
- offset += 4
- }
-
- if (fieldMask and MASK_NORMAL_BOLUS != 0) {
- aapsLogger.debug(LTag.PUMPCOMM, "Normal bolus notification received")
- val bolusData = data.copyOfRange(offset, offset + 1).toInt()
- val bolusType = bolusData and 0x7F
- val bolusCompleted: Boolean = ((bolusData shr 7) and 0x01) != 0
- val bolusDelivered = data.copyOfRange(offset + 1, offset + 3).toInt() * 0.05
- aapsLogger.debug(LTag.PUMPCOMM, "Bolus type: $bolusType, bolusData: $bolusData bolus completed: $bolusCompleted, bolus delivered: $bolusDelivered")
- medtrumPump.handleBolusStatusUpdate(bolusType, bolusCompleted, bolusDelivered)
- offset += 3
- }
-
- if (fieldMask and MASK_EXTENDED_BOLUS != 0) {
- aapsLogger.error(LTag.PUMPCOMM, "Extended bolus notification received, extended bolus not supported!")
- offset += 3
- }
-
- if (fieldMask and MASK_BASAL != 0) {
- aapsLogger.debug(LTag.PUMPCOMM, "Basal notification received")
- val basalType = enumValues()[data.copyOfRange(offset, offset + 1).toInt()]
- val basalSequence = data.copyOfRange(offset + 1, offset + 3).toInt()
- val basalPatchId = data.copyOfRange(offset + 3, offset + 5).toLong()
- val basalStartTime = MedtrumTimeUtil().convertPumpTimeToSystemTimeMillis(data.copyOfRange(offset + 5, offset + 9).toLong())
- val basalRateAndDelivery = data.copyOfRange(offset + 9, offset + 12).toInt()
- val basalRate = (basalRateAndDelivery and 0xFFF) * 0.05
- val basalDelivery = (basalRateAndDelivery shr 12) * 0.05
- aapsLogger.debug(
- LTag.PUMPCOMM,
- "Basal type: $basalType, basal sequence: $basalSequence, basal patch id: $basalPatchId, basal time: $basalStartTime, basal rate: $basalRate, basal delivery: $basalDelivery"
- )
- // Don't spam with basal updates here, only if the running basal rate has changed, or a new basal is set
- if (medtrumPump.lastBasalRate != basalRate || medtrumPump.lastBasalStartTime != basalStartTime) {
- medtrumPump.handleBasalStatusUpdate(basalType, basalRate, basalSequence, basalPatchId, basalStartTime)
+ for ((mask, handler) in maskHandlers) {
+ if (fieldMask and mask != 0) {
+ offset = handler(data, offset)
}
- offset += 12
}
- if (fieldMask and MASK_SETUP != 0) {
- aapsLogger.debug(LTag.PUMPCOMM, "Setup notification received")
- medtrumPump.primeProgress = data.copyOfRange(offset, offset + 1).toInt()
- aapsLogger.debug(LTag.PUMPCOMM, "Prime progress: ${medtrumPump.primeProgress}")
- offset += 1
- }
+ return true
+ }
- if (fieldMask and MASK_RESERVOIR != 0) {
- aapsLogger.debug(LTag.PUMPCOMM, "Reservoir notification received")
- medtrumPump.reservoir = data.copyOfRange(offset, offset + 2).toInt() * 0.05
- aapsLogger.debug(LTag.PUMPCOMM, "Reservoir: ${medtrumPump.reservoir}")
- offset += 2
- }
+ private fun calculateExpectedLengthBasedOnFieldMask(fieldMask: Int): Int {
+ var expectedLength = SIZE_FIELD_MASK
- if (fieldMask and MASK_START_TIME != 0) {
- aapsLogger.debug(LTag.PUMPCOMM, "Start time notification received")
- newPatchStartTime = MedtrumTimeUtil().convertPumpTimeToSystemTimeMillis(data.copyOfRange(offset, offset + 4).toLong())
- if (medtrumPump.patchStartTime != newPatchStartTime) {
- aapsLogger.debug(LTag.PUMPCOMM, "Patch start time changed from ${medtrumPump.patchStartTime} to $newPatchStartTime")
- medtrumPump.patchStartTime = newPatchStartTime
+ val sizeMap = mapOf(
+ MASK_SUSPEND to SIZE_SUSPEND,
+ MASK_NORMAL_BOLUS to SIZE_NORMAL_BOLUS,
+ MASK_EXTENDED_BOLUS to SIZE_EXTENDED_BOLUS,
+ MASK_BASAL to SIZE_BASAL,
+ MASK_SETUP to SIZE_SETUP,
+ MASK_RESERVOIR to SIZE_RESERVOIR,
+ MASK_START_TIME to SIZE_START_TIME,
+ MASK_BATTERY to SIZE_BATTERY,
+ MASK_STORAGE to SIZE_STORAGE,
+ MASK_ALARM to SIZE_ALARM,
+ MASK_AGE to SIZE_AGE,
+ MASK_MAGNETO_PLACE to SIZE_MAGNETO_PLACE,
+ MASK_UNUSED_CGM to SIZE_UNUSED_CGM,
+ MASK_UNUSED_COMMAND_CONFIRM to SIZE_UNUSED_COMMAND_CONFIRM,
+ MASK_UNUSED_AUTO_STATUS to SIZE_UNUSED_AUTO_STATUS,
+ MASK_UNUSED_LEGACY to SIZE_UNUSED_LEGACY
+ )
+
+ for ((mask, size) in sizeMap) {
+ if (fieldMask and mask != 0) {
+ expectedLength += size
}
- aapsLogger.debug(LTag.PUMPCOMM, "Patch start time: $newPatchStartTime")
- offset += 4
}
- if (fieldMask and MASK_BATTERY != 0) {
- aapsLogger.debug(LTag.PUMPCOMM, "Battery notification received")
- val parameter = data.copyOfRange(offset, offset + 3).toInt()
- // Precision for voltage A is a guess, voltage B is the important one, threshold: < 2.64
- medtrumPump.batteryVoltage_A = (parameter and 0xFFF) / 512.0
- medtrumPump.batteryVoltage_B = (parameter shr 12) / 512.0
- aapsLogger.debug(LTag.PUMPCOMM, "Battery voltage A: ${medtrumPump.batteryVoltage_A}, battery voltage B: ${medtrumPump.batteryVoltage_B}")
- offset += 3
- }
+ return expectedLength
+ }
- if (fieldMask and MASK_STORAGE != 0) {
- aapsLogger.debug(LTag.PUMPCOMM, "Storage notification received")
- val sequence = data.copyOfRange(offset, offset + 2).toInt()
- if (sequence > medtrumPump.currentSequenceNumber) {
- medtrumPump.currentSequenceNumber = sequence
+ private fun handleSuspend(data: ByteArray, offset: Int): Int {
+ aapsLogger.debug(LTag.PUMPCOMM, "Suspend notification received")
+ medtrumPump.suspendTime = MedtrumTimeUtil().convertPumpTimeToSystemTimeMillis(data.copyOfRange(offset, offset + 4).toLong())
+ aapsLogger.debug(LTag.PUMPCOMM, "Suspend time: ${medtrumPump.suspendTime}")
+ return offset + SIZE_SUSPEND
+ }
+
+ private fun handleNormalBolus(data: ByteArray, offset: Int): Int {
+ aapsLogger.debug(LTag.PUMPCOMM, "Normal bolus notification received")
+ val bolusData = data.copyOfRange(offset, offset + 1).toInt()
+ val bolusType = bolusData and 0x7F
+ val bolusCompleted: Boolean = ((bolusData shr 7) and 0x01) != 0
+ val bolusDelivered = data.copyOfRange(offset + 1, offset + 3).toInt() * 0.05
+ aapsLogger.debug(LTag.PUMPCOMM, "Bolus type: $bolusType, bolusData: $bolusData bolus completed: $bolusCompleted, bolus delivered: $bolusDelivered")
+ medtrumPump.handleBolusStatusUpdate(bolusType, bolusCompleted, bolusDelivered)
+ return offset + SIZE_NORMAL_BOLUS
+ }
+
+ private fun handleExtendedBolus(data: ByteArray, offset: Int): Int {
+ aapsLogger.error(LTag.PUMPCOMM, "Extended bolus notification received, extended bolus not supported!")
+ aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus data: ${data.copyOfRange(offset, offset + SIZE_EXTENDED_BOLUS).toLong()}")
+ return offset + SIZE_EXTENDED_BOLUS
+ }
+
+ private fun handleBasal(data: ByteArray, offset: Int): Int {
+ aapsLogger.debug(LTag.PUMPCOMM, "Basal notification received")
+ val basalType = enumValues()[data.copyOfRange(offset, offset + 1).toInt()]
+ val basalSequence = data.copyOfRange(offset + 1, offset + 3).toInt()
+ val basalPatchId = data.copyOfRange(offset + 3, offset + 5).toLong()
+ val basalStartTime = MedtrumTimeUtil().convertPumpTimeToSystemTimeMillis(data.copyOfRange(offset + 5, offset + 9).toLong())
+ val basalRateAndDelivery = data.copyOfRange(offset + 9, offset + 12).toInt()
+ val basalRate = (basalRateAndDelivery and 0xFFF) * 0.05
+ val basalDelivery = (basalRateAndDelivery shr 12) * 0.05
+ aapsLogger.debug(
+ LTag.PUMPCOMM,
+ "Basal type: $basalType, basal sequence: $basalSequence, basal patch id: $basalPatchId, basal time: $basalStartTime, basal rate: $basalRate, basal delivery: $basalDelivery"
+ )
+ // Don't spam with basal updates here, only if the running basal rate has changed, or a new basal is set
+ if (medtrumPump.lastBasalRate != basalRate || medtrumPump.lastBasalStartTime != basalStartTime) {
+ medtrumPump.handleBasalStatusUpdate(basalType, basalRate, basalSequence, basalPatchId, basalStartTime)
+ }
+ return offset + SIZE_BASAL
+ }
+
+ private fun handleSetup(data: ByteArray, offset: Int): Int {
+ aapsLogger.debug(LTag.PUMPCOMM, "Setup notification received")
+ medtrumPump.primeProgress = data.copyOfRange(offset, offset + 1).toInt()
+ aapsLogger.debug(LTag.PUMPCOMM, "Prime progress: ${medtrumPump.primeProgress}")
+ return offset + SIZE_SETUP
+ }
+
+ private fun handleReservoir(data: ByteArray, offset: Int): Int {
+ aapsLogger.debug(LTag.PUMPCOMM, "Reservoir notification received")
+ medtrumPump.reservoir = data.copyOfRange(offset, offset + 2).toInt() * 0.05
+ aapsLogger.debug(LTag.PUMPCOMM, "Reservoir: ${medtrumPump.reservoir}")
+ return offset + SIZE_RESERVOIR
+ }
+
+ private fun handleStartTime(data: ByteArray, offset: Int): Int {
+ aapsLogger.debug(LTag.PUMPCOMM, "Start time notification received")
+ newPatchStartTime = MedtrumTimeUtil().convertPumpTimeToSystemTimeMillis(data.copyOfRange(offset, offset + 4).toLong())
+ if (medtrumPump.patchStartTime != newPatchStartTime) {
+ aapsLogger.debug(LTag.PUMPCOMM, "Patch start time changed from ${medtrumPump.patchStartTime} to $newPatchStartTime")
+ medtrumPump.patchStartTime = newPatchStartTime
+ }
+ aapsLogger.debug(LTag.PUMPCOMM, "Patch start time: $newPatchStartTime")
+ return offset + SIZE_START_TIME
+ }
+
+ private fun handleBattery(data: ByteArray, offset: Int): Int {
+ aapsLogger.debug(LTag.PUMPCOMM, "Battery notification received")
+ val parameter = data.copyOfRange(offset, offset + 3).toInt()
+ // Precision for voltage A is a guess, voltage B is the important one, threshold: < 2.64
+ medtrumPump.batteryVoltage_A = (parameter and 0xFFF) / 512.0
+ medtrumPump.batteryVoltage_B = (parameter shr 12) / 512.0
+ aapsLogger.debug(LTag.PUMPCOMM, "Battery voltage A: ${medtrumPump.batteryVoltage_A}, battery voltage B: ${medtrumPump.batteryVoltage_B}")
+ return offset + SIZE_BATTERY
+ }
+
+ private fun handleStorage(data: ByteArray, offset: Int): Int {
+ aapsLogger.debug(LTag.PUMPCOMM, "Storage notification received")
+ val sequence = data.copyOfRange(offset, offset + 2).toInt()
+ if (sequence > medtrumPump.currentSequenceNumber) {
+ medtrumPump.currentSequenceNumber = sequence
+ }
+ val patchId = data.copyOfRange(offset + 2, offset + 4).toLong()
+ if (patchId != medtrumPump.patchId) {
+ aapsLogger.warn(LTag.PUMPCOMM, "handleMaskedMessage: We got wrong patch id!")
+ if (newPatchStartTime != 0L) {
+ // This is a fallback for when the activate packet did not receive the ack but the patch activated anyway
+ aapsLogger.error(LTag.PUMPCOMM, "handleMaskedMessage: Also Received start time in this packet, registering new patch id: $patchId")
+ medtrumPump.handleNewPatch(patchId, sequence, newPatchStartTime)
}
- val patchId = data.copyOfRange(offset + 2, offset + 4).toLong()
- if (patchId != medtrumPump.patchId) {
- aapsLogger.warn(LTag.PUMPCOMM, "handleMaskedMessage: We got wrong patch id!")
- if (newPatchStartTime != null) {
- // This is a fallback for when the activate packet did not receive the ack but the patch activated anyway
- aapsLogger.error(LTag.PUMPCOMM, "handleMaskedMessage: Also Received start time in this packet, registering new patch id: $patchId")
- medtrumPump.handleNewPatch(patchId, sequence, newPatchStartTime)
- }
- }
- aapsLogger.debug(LTag.PUMPCOMM, "Last known sequence number: ${medtrumPump.currentSequenceNumber}, patch id: ${patchId}")
- offset += 4
}
+ aapsLogger.debug(LTag.PUMPCOMM, "Last known sequence number: ${medtrumPump.currentSequenceNumber}, patch id: ${patchId}")
+ return offset + SIZE_STORAGE
+ }
- if (fieldMask and MASK_ALARM != 0) {
- val alarmFlags = data.copyOfRange(offset, offset + 2).toInt()
- val alarmParameter = data.copyOfRange(offset + 2, offset + 4).toInt()
- aapsLogger.debug(LTag.PUMPCOMM, "Alarm notification received, Alarm flags: $alarmFlags, alarm parameter: $alarmParameter")
+ private fun handleAlarm(data: ByteArray, offset: Int): Int {
+ val alarmFlags = data.copyOfRange(offset, offset + 2).toInt()
+ val alarmParameter = data.copyOfRange(offset + 2, offset + 4).toInt()
+ aapsLogger.debug(LTag.PUMPCOMM, "Alarm notification received, Alarm flags: $alarmFlags, alarm parameter: $alarmParameter")
- // If no alarm, clear activeAlarm list
- if (alarmFlags == 0 && medtrumPump.activeAlarms.isNotEmpty()) {
- medtrumPump.clearAlarmState()
- } else if (alarmFlags != 0) {
- // Check each alarm bit
- for (i in 0..3) { // Only the first 3 flags are interesting for us, the rest we will get from the pump state
- val alarmState = AlarmState.values()[i]
- if ((alarmFlags shr i) and 1 != 0) {
- // If the alarm bit is set, add the corresponding alarm to activeAlarms
+ // If no alarm, clear activeAlarm list
+ if (alarmFlags == 0 && medtrumPump.activeAlarms.isNotEmpty()) {
+ medtrumPump.clearAlarmState()
+ } else if (alarmFlags != 0) {
+ // Check each alarm bit
+ for (i in 0..3) { // Only the first 3 flags are interesting for us, the rest we will get from the pump state
+ val alarmState = AlarmState.values()[i]
+ if ((alarmFlags shr i) and 1 != 0) {
+ // If the alarm bit is set, add the corresponding alarm to activeAlarms
+ if (!medtrumPump.activeAlarms.contains(alarmState)) {
+ aapsLogger.debug(LTag.PUMPCOMM, "Adding alarm $alarmState to active alarms")
medtrumPump.addAlarm(alarmState)
- } else if (medtrumPump.activeAlarms.contains(alarmState)) {
- // If the alarm bit is not set, and the corresponding alarm is in activeAlarms, remove it
- medtrumPump.removeAlarm(alarmState)
+ medtrumPump.pumpWarning = alarmState
}
+ } else if (medtrumPump.activeAlarms.contains(alarmState)) {
+ // If the alarm bit is not set, and the corresponding alarm is in activeAlarms, remove it
+ medtrumPump.removeAlarm(alarmState)
}
}
- offset += 4
}
+ return offset + SIZE_ALARM
+ }
- if (fieldMask and MASK_AGE != 0) {
- aapsLogger.debug(LTag.PUMPCOMM, "Age notification received")
- medtrumPump.patchAge = data.copyOfRange(offset, offset + 4).toLong()
- aapsLogger.debug(LTag.PUMPCOMM, "Patch age: ${medtrumPump.patchAge}")
- offset += 4
- }
+ private fun handleAge(data: ByteArray, offset: Int): Int {
+ aapsLogger.debug(LTag.PUMPCOMM, "Age notification received")
+ medtrumPump.patchAge = data.copyOfRange(offset, offset + 4).toLong()
+ aapsLogger.debug(LTag.PUMPCOMM, "Patch age: ${medtrumPump.patchAge}")
+ return offset + SIZE_AGE
+ }
- if (fieldMask and MASK_UNKNOWN_1 != 0) {
- aapsLogger.debug(LTag.PUMPCOMM, "Unknown 1 notification received, not handled!")
- }
+ private fun handleUnknown1(data: ByteArray, offset: Int): Int {
+ aapsLogger.debug(LTag.PUMPCOMM, "Magneto placement notification received!")
+ val magnetoPlacement = data.copyOfRange(offset, offset + 2).toInt()
+ aapsLogger.debug(LTag.PUMPCOMM, "Magneto placement: $magnetoPlacement")
+ return offset + SIZE_MAGNETO_PLACE
+ }
- if (fieldMask and MASK_UNUSED_CGM != 0) {
- aapsLogger.debug(LTag.PUMPCOMM, "Unused CGM notification received, not handled!")
- }
+ private fun handleUnusedCGM(data: ByteArray, offset: Int): Int {
+ aapsLogger.debug(LTag.PUMPCOMM, "Unused CGM notification received, not handled!")
+ aapsLogger.debug(LTag.PUMPCOMM, "Unused CGM data: ${data.copyOfRange(offset, offset + SIZE_UNUSED_CGM).toLong()}")
+ return offset + SIZE_UNUSED_CGM
+ }
- if (fieldMask and MASK_UNUSED_COMMAND_CONFIRM != 0) {
- // This one is a warning, as this happens we need to know about it, and maybe implement
- aapsLogger.warn(LTag.PUMPCOMM, "Unused command confirm notification received, not handled!")
- }
+ private fun handleUnusedCommandConfirm(data: ByteArray, offset: Int): Int {
+ aapsLogger.warn(LTag.PUMPCOMM, "Unused command confirm notification received, not handled!")
+ aapsLogger.debug(LTag.PUMPCOMM, "Unused command confirm data: ${data.copyOfRange(offset, offset + SIZE_UNUSED_COMMAND_CONFIRM).toLong()}")
+ return offset + SIZE_UNUSED_COMMAND_CONFIRM
+ }
- if (fieldMask and MASK_UNUSED_AUTO_STATUS != 0) {
- aapsLogger.debug(LTag.PUMPCOMM, "Unused auto status notification received, not handled!")
- }
+ private fun handleUnusedAutoStatus(data: ByteArray, offset: Int): Int {
+ aapsLogger.debug(LTag.PUMPCOMM, "Unused auto status notification received, not handled!")
+ aapsLogger.debug(LTag.PUMPCOMM, "Unused auto status data: ${data.copyOfRange(offset, offset + SIZE_UNUSED_AUTO_STATUS).toLong()}")
+ return offset + SIZE_UNUSED_AUTO_STATUS
+ }
- if (fieldMask and MASK_UNUSED_LEGACY != 0) {
- aapsLogger.debug(LTag.PUMPCOMM, "Unused legacy notification received, not handled!")
- }
+ private fun handleUnusedLegacy(data: ByteArray, offset: Int): Int {
+ aapsLogger.debug(LTag.PUMPCOMM, "Unused legacy notification received, not handled!")
+ aapsLogger.debug(LTag.PUMPCOMM, "Unused legacy data: ${data.copyOfRange(offset, offset + SIZE_UNUSED_LEGACY).toLong()}")
+ return offset + SIZE_UNUSED_LEGACY
}
}
diff --git a/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/comm/packets/SynchronizePacket.kt b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/comm/packets/SynchronizePacket.kt
index 97e8d15222..8d35793052 100644
--- a/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/comm/packets/SynchronizePacket.kt
+++ b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/comm/packets/SynchronizePacket.kt
@@ -31,7 +31,7 @@ class SynchronizePacket(injector: HasAndroidInjector) : MedtrumPacket(injector)
}
override fun handleResponse(data: ByteArray): Boolean {
- val success = super.handleResponse(data)
+ var success = super.handleResponse(data)
if (success) {
val state = MedtrumPumpState.fromByte(data[RESP_STATE_START])
@@ -63,7 +63,7 @@ class SynchronizePacket(injector: HasAndroidInjector) : MedtrumPacket(injector)
}
// Let the notification packet handle the rest of the sync data
- NotificationPacket(injector).handleMaskedMessage(fieldMask.toByteArray(2) + syncData)
+ success = NotificationPacket(injector).handleMaskedMessage(fieldMask.toByteArray(2) + syncData)
}
return success
diff --git a/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/services/BLEComm.kt b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/services/BLEComm.kt
index cc5283b9dd..c2b76b71fa 100644
--- a/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/services/BLEComm.kt
+++ b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/services/BLEComm.kt
@@ -40,7 +40,7 @@ interface BLECommCallback {
fun onBLEDisconnected()
fun onNotification(notification: ByteArray)
fun onIndication(indication: ByteArray)
- fun onSendMessageError(reason: String)
+ fun onSendMessageError(reason: String, isRetryAble: Boolean)
}
@Singleton
@@ -258,7 +258,11 @@ class BLEComm @Inject internal constructor(
mReadPacket?.addData(value)
}
if (mReadPacket?.allDataReceived() == true) {
- mReadPacket?.getData()?.let { mCallback?.onIndication(it) }
+ if (mReadPacket?.failed() == true) {
+ mCallback?.onSendMessageError("ReadDataPacket failed", false)
+ } else {
+ mReadPacket?.getData()?.let { mCallback?.onIndication(it) }
+ }
mReadPacket = null
}
}
@@ -279,7 +283,7 @@ class BLEComm @Inject internal constructor(
}
}
} else {
- mCallback?.onSendMessageError("onCharacteristicWrite failure")
+ mCallback?.onSendMessageError("onCharacteristicWrite failure", true)
}
}
@@ -404,7 +408,7 @@ class BLEComm @Inject internal constructor(
writeCharacteristic(uartWriteBTGattChar, value)
} else {
aapsLogger.error(LTag.PUMPBTCOMM, "sendMessage error in writePacket!")
- mCallback?.onSendMessageError("error in writePacket!")
+ mCallback?.onSendMessageError("error in writePacket!", false)
}
}
@@ -430,7 +434,7 @@ class BLEComm @Inject internal constructor(
aapsLogger.debug(LTag.PUMPBTCOMM, "writeCharacteristic: ${Arrays.toString(data)}")
val success = mBluetoothGatt?.writeCharacteristic(characteristic)
if (success != true) {
- mCallback?.onSendMessageError("Failed to write characteristic")
+ mCallback?.onSendMessageError("Failed to write characteristic", true)
}
}
}, WRITE_DELAY_MILLIS)
diff --git a/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/services/MedtrumService.kt b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/services/MedtrumService.kt
index 91057b7aaf..ae596414e9 100644
--- a/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/services/MedtrumService.kt
+++ b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/services/MedtrumService.kt
@@ -164,6 +164,11 @@ class MedtrumService : DaggerService(), BLECommCallback {
handleConnectionStateChange(connectionState)
}
}
+ scope.launch {
+ medtrumPump.pumpWarningFlow.collect { pumpWarning ->
+ notifyPumpWarning(pumpWarning)
+ }
+ }
}
override fun onDestroy() {
@@ -317,6 +322,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
}
// Resume suspended pump
if (result) result = sendPacketAndGetResponse(ResumePumpPacket(injector))
+ if (result) medtrumPump.clearAlarmState()
}
return result
}
@@ -330,21 +336,22 @@ class MedtrumService : DaggerService(), BLECommCallback {
if (!canSetBolus()) return false
val insulin = detailedBolusInfo.insulin
+ medtrumPump.bolusDone = false
+ medtrumPump.bolusStopped = false
if (!sendBolusCommand(insulin)) {
aapsLogger.error(LTag.PUMPCOMM, "Failed to set bolus")
- commandQueue.loadEvents(null) // make sure if anything is delivered (which is highly unlikely at this point) we get it
+ commandQueue.readStatus(rh.gs(R.string.bolus_error), null) // make sure if anything is delivered (which is highly unlikely at this point) we get it
+ medtrumPump.bolusDone = true
t.insulin = 0.0
return false
}
val bolusStart = System.currentTimeMillis()
- medtrumPump.bolusDone = false
- medtrumPump.bolusingTreatment = t
- medtrumPump.bolusAmountToBeDelivered = insulin
- medtrumPump.bolusStopped = false
medtrumPump.bolusProgressLastTimeStamp = bolusStart
medtrumPump.bolusStartTime = bolusStart
+ medtrumPump.bolusingTreatment = t
+ medtrumPump.bolusAmountToBeDelivered = insulin
detailedBolusInfo.timestamp = bolusStart // Make sure the timestamp is set to the start of the bolus
detailedBolusInfoStorage.add(detailedBolusInfo) // will be picked up on reading history
@@ -420,6 +427,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
var communicationLost = false
var connectionRetryCounter = 0
var checkTime = medtrumPump.bolusProgressLastTimeStamp
+ var lastSentBolusAmount: Double? = null
while (!medtrumPump.bolusStopped && !medtrumPump.bolusDone && !communicationLost) {
SystemClock.sleep(100)
@@ -436,10 +444,15 @@ class MedtrumService : DaggerService(), BLECommCallback {
disconnect("Communication stopped")
}
} else {
- bolusingEvent.t = medtrumPump.bolusingTreatment
- bolusingEvent.status = rh.gs(info.nightscout.pump.common.R.string.bolus_delivered_so_far, medtrumPump.bolusingTreatment?.insulin, medtrumPump.bolusAmountToBeDelivered)
- bolusingEvent.percent = round((medtrumPump.bolusingTreatment?.insulin?.div(medtrumPump.bolusAmountToBeDelivered) ?: 0.0) * 100).toInt() - 1
- rxBus.send(bolusingEvent)
+ val currentBolusAmount = medtrumPump.bolusingTreatment?.insulin
+
+ if (currentBolusAmount != null && currentBolusAmount != lastSentBolusAmount) {
+ bolusingEvent.t = medtrumPump.bolusingTreatment
+ bolusingEvent.status = rh.gs(info.nightscout.pump.common.R.string.bolus_delivered_so_far, medtrumPump.bolusingTreatment?.insulin, medtrumPump.bolusAmountToBeDelivered)
+ bolusingEvent.percent = round(currentBolusAmount.div(medtrumPump.bolusAmountToBeDelivered) * 100).toInt() - 1
+ rxBus.send(bolusingEvent)
+ lastSentBolusAmount = currentBolusAmount
+ }
}
}
@@ -577,6 +590,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
when (state) {
MedtrumPumpState.NONE,
MedtrumPumpState.STOPPED -> {
+ rxBus.send(EventDismissNotification(Notification.PUMP_WARNING))
rxBus.send(EventDismissNotification(Notification.PUMP_ERROR))
rxBus.send(EventDismissNotification(Notification.PUMP_SUSPENDED))
uiInteraction.addNotification(
@@ -607,7 +621,6 @@ class MedtrumService : DaggerService(), BLECommCallback {
MedtrumPumpState.ACTIVE_ALT -> {
rxBus.send(EventDismissNotification(Notification.PATCH_NOT_ACTIVE))
rxBus.send(EventDismissNotification(Notification.PUMP_SUSPENDED))
- medtrumPump.clearAlarmState()
}
MedtrumPumpState.LOW_BG_SUSPENDED,
@@ -625,20 +638,22 @@ class MedtrumService : DaggerService(), BLECommCallback {
}
MedtrumPumpState.HOURLY_MAX_SUSPENDED -> {
- uiInteraction.addNotification(
+ uiInteraction.addNotificationWithSound(
Notification.PUMP_SUSPENDED,
rh.gs(R.string.pump_is_suspended_hour_max),
- Notification.NORMAL,
+ Notification.URGENT,
+ app.aaps.core.ui.R.raw.alarm
)
// Pump will report proper TBR for this from loadEvents()
commandQueue.loadEvents(null)
}
MedtrumPumpState.DAILY_MAX_SUSPENDED -> {
- uiInteraction.addNotification(
+ uiInteraction.addNotificationWithSound(
Notification.PUMP_SUSPENDED,
rh.gs(R.string.pump_is_suspended_day_max),
- Notification.NORMAL,
+ Notification.URGENT,
+ app.aaps.core.ui.R.raw.alarm
)
// Pump will report proper TBR for this from loadEvents()
commandQueue.loadEvents(null)
@@ -683,6 +698,23 @@ class MedtrumService : DaggerService(), BLECommCallback {
}
}
+ private fun notifyPumpWarning(alarmState: AlarmState) {
+ // Notification on pump warning
+ if (sp.getBoolean(R.string.key_pump_warning_notification, true) && alarmState != AlarmState.NONE) {
+ uiInteraction.addNotification(
+ Notification.PUMP_WARNING,
+ rh.gs(R.string.pump_warning, medtrumPump.alarmStateToString(alarmState)),
+ Notification.ANNOUNCEMENT,
+ )
+ pumpSync.insertAnnouncement(
+ medtrumPump.alarmStateToString(alarmState),
+ null,
+ medtrumPump.pumpType(),
+ medtrumPump.pumpSN.toString(radix = 16)
+ )
+ }
+ }
+
/** BLECommCallbacks */
override fun onBLEConnected() {
aapsLogger.debug(LTag.PUMPCOMM, "<<<<< onBLEConnected")
@@ -704,9 +736,9 @@ class MedtrumService : DaggerService(), BLECommCallback {
currentState.onIndication(indication)
}
- override fun onSendMessageError(reason: String) {
+ override fun onSendMessageError(reason: String, isRetryAble: Boolean) {
aapsLogger.debug(LTag.PUMPCOMM, "<<<<< error during send message $reason")
- currentState.onSendMessageError(reason)
+ currentState.onSendMessageError(reason, isRetryAble)
}
/** Service stuff */
@@ -791,10 +823,10 @@ class MedtrumService : DaggerService(), BLECommCallback {
return responseSuccess
}
- fun onSendMessageError(reason: String) {
+ fun onSendMessageError(reason: String, isRetryAble: Boolean) {
aapsLogger.warn(LTag.PUMPCOMM, "onSendMessageError: " + this.toString() + "reason: $reason")
// Retry 3 times
- if (sendRetryCounter < 3) {
+ if (sendRetryCounter < 3 && isRetryAble) {
sendRetryCounter++
mPacket?.getRequest()?.let { bleComm.sendMessage(it) }
} else {
diff --git a/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/util/CrcUtil.kt b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/util/CrcUtil.kt
new file mode 100644
index 0000000000..211f35da72
--- /dev/null
+++ b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/util/CrcUtil.kt
@@ -0,0 +1,13 @@
+object CrcUtils {
+
+ private val lookupTable: UByteArray = ubyteArrayOf(0u, 155u, 173u, 54u, 193u, 90u, 108u, 247u, 25u, 130u, 180u, 47u, 216u, 67u, 117u, 238u, 50u, 169u, 159u, 4u, 243u, 104u, 94u, 197u, 43u, 176u, 134u, 29u, 234u, 113u, 71u, 220u, 100u, 255u, 201u, 82u, 165u, 62u, 8u, 147u, 125u, 230u, 208u, 75u, 188u, 39u, 17u, 138u, 86u, 205u, 251u, 96u, 151u, 12u, 58u, 161u, 79u, 212u, 226u, 121u, 142u, 21u, 35u, 184u, 200u, 83u, 101u, 254u, 9u, 146u, 164u, 63u, 209u, 74u, 124u, 231u, 16u, 139u, 189u, 38u, 250u, 97u, 87u, 204u, 59u, 160u, 150u, 13u, 227u, 120u, 78u, 213u, 34u, 185u, 143u, 20u, 172u, 55u, 1u, 154u, 109u, 246u, 192u, 91u, 181u, 46u, 24u, 131u, 116u, 239u, 217u, 66u, 158u, 5u, 51u, 168u, 95u, 196u, 242u, 105u, 135u, 28u, 42u, 177u, 70u, 221u, 235u, 112u, 11u, 144u, 166u, 61u, 202u, 81u, 103u, 252u, 18u, 137u, 191u, 36u, 211u, 72u, 126u, 229u, 57u, 162u, 148u, 15u, 248u, 99u, 85u, 206u, 32u, 187u, 141u, 22u, 225u, 122u, 76u, 215u, 111u, 244u, 194u, 89u, 174u, 53u, 3u, 152u, 118u, 237u, 219u, 64u, 183u, 44u, 26u, 129u, 93u, 198u, 240u, 107u, 156u, 7u, 49u, 170u, 68u, 223u, 233u, 114u, 133u, 30u, 40u, 179u, 195u, 88u, 110u, 245u, 2u, 153u, 175u, 52u, 218u, 65u, 119u, 236u, 27u, 128u, 182u, 45u, 241u, 106u, 92u, 199u, 48u, 171u, 157u, 6u, 232u, 115u, 69u, 222u, 41u, 178u, 132u, 31u, 167u, 60u, 10u, 145u, 102u, 253u, 203u, 80u, 190u, 37u, 19u, 136u, 127u, 228u, 210u, 73u, 149u, 14u, 56u, 163u, 84u, 207u, 249u, 98u, 140u, 23u, 33u, 186u, 77u, 214u, 224u, 123u)
+
+ fun calcCrc8(value: ByteArray, size: Int): Byte {
+ var crc8: UByte = 0u
+ for (i in 0 until size) {
+ val tableIndex: UByte = (value[i].toUByte() xor crc8)
+ crc8 = lookupTable[tableIndex.toInt()]
+ }
+ return crc8.toByte()
+ }
+}
diff --git a/pump/medtrum/src/main/res/values-cs-rCZ/strings.xml b/pump/medtrum/src/main/res/values-cs-rCZ/strings.xml
index 2fd23c2faf..3bd036a325 100644
--- a/pump/medtrum/src/main/res/values-cs-rCZ/strings.xml
+++ b/pump/medtrum/src/main/res/values-cs-rCZ/strings.xml
@@ -6,6 +6,7 @@
Integrace pumpy pro Medtrum Nano a Medtrum 300U
Nastavení pumpy Medtrum
Chyba pumpy: %1$s!!
+ Varování pumpy: %1$s
Pumpa je pozastavena
Pumpa je pozastavena kvůli překročení maximálního množství inzulínu za hodinu
Pumpa je pozastavena kvůli překročení maximálního množství inzulínu za den
@@ -106,6 +107,8 @@
Nevyzkoušená pumpa: %1$d! Kontaktujte nás na Discordu nebo Githubu, kde získáte podporu.
Nastavení alarmů
Vyberte preferované nastavení alarmů.
+ Oznámení o varování pumpy
+ Zobrazit upozornění na nekritická varování pumpy: vybitá baterie, téměř prázdný zásobník (20 jednotek) a brzy dojde inzulin. Doporučeno ponechat zapnuté, když jsou výstrahy pumpy nastaveny na ticho.
Vypršení platnosti Patche
Pokud je povoleno, Patch vyprší po 3 dnech s maximální dobou odkladu 8 hodin.
Hodinové maximum inzulínu
diff --git a/pump/medtrum/src/main/res/values-es-rES/strings.xml b/pump/medtrum/src/main/res/values-es-rES/strings.xml
index 8a99c08eff..50534174b7 100644
--- a/pump/medtrum/src/main/res/values-es-rES/strings.xml
+++ b/pump/medtrum/src/main/res/values-es-rES/strings.xml
@@ -6,6 +6,7 @@
Integración de bombas de insulina Medtrum Nano y Medtrum 300U
Ajustes de la bomba Medtrum
Error de bomba: %1$s !!
+ Advertencia de la bomba: %1$s
Bomba suspendida
Bomba suspendida por superarse el máximo de insulina por hora
Bomba suspendida por superar el máximo diario de insulina
@@ -106,6 +107,8 @@
Bomba no probada: %1$d! Por favor, contacta con nosotros en Discord o GitHub para obtener soporte
Ajustes de las alarmas
Selecciona los ajustes de la alarma de la bomba que prefieras.
+ Notificación sobre advertencia de la bomba
+ Mostrar notificación en advertencias de la bomba no críticas: batería baja, reserva baja (20 unidades) y próxima a caducar. Se recomienda dejarlo habilitado cuando las alarmas de la bomba estén configuradas en silencio.
Caducidad del parche
Cuando está activado, el parche caducará a los 3 días, con un periodo de gracia de 8 horas adicionales
Insulina máxima por hora
diff --git a/pump/medtrum/src/main/res/values-lt-rLT/strings.xml b/pump/medtrum/src/main/res/values-lt-rLT/strings.xml
index 98952d7733..da7983f437 100644
--- a/pump/medtrum/src/main/res/values-lt-rLT/strings.xml
+++ b/pump/medtrum/src/main/res/values-lt-rLT/strings.xml
@@ -70,6 +70,7 @@
Įjungiama
Netikėta būsena: %1$s
Nepasirinktas profilis. Pasirinkite profilį ir bandykite dar kartą.
+ Nežinomas SN. Įveskite pompos pagrindo serijos numerį nustatymuose ir bandykite vėl.
Pompos pagrindo SN: %1$X
Nėra aktyvaus rezervuaro. Spauskite Kitas ir pradėkite aktyvavimą.
Neprijunkite pagrindo prie rezervuaro iki kito žingsnio!
diff --git a/pump/medtrum/src/main/res/values-no-rNO/arrays.xml b/pump/medtrum/src/main/res/values-nb-rNO/arrays.xml
similarity index 100%
rename from pump/medtrum/src/main/res/values-no-rNO/arrays.xml
rename to pump/medtrum/src/main/res/values-nb-rNO/arrays.xml
diff --git a/pump/medtrum/src/main/res/values-no-rNO/strings.xml b/pump/medtrum/src/main/res/values-nb-rNO/strings.xml
similarity index 95%
rename from pump/medtrum/src/main/res/values-no-rNO/strings.xml
rename to pump/medtrum/src/main/res/values-nb-rNO/strings.xml
index 99d7018610..b2f4013796 100644
--- a/pump/medtrum/src/main/res/values-no-rNO/strings.xml
+++ b/pump/medtrum/src/main/res/values-nb-rNO/strings.xml
@@ -6,6 +6,7 @@
Pumpeintegrasjon for Medtrum Nano og Medtrum 300U
Medtrum pumpeinnstillinger
Pumpefeil: %1$s!!
+ Pumpeadvarsel: %1$s
Pumpen er pauset
Pumpe er pauset fordi maksimal insulinleveranse per time er overskredet
Pumpe er pauset fordi maksimal insulinleveranse per dag er overskredet
@@ -106,6 +107,8 @@
Pumpe ikke testet: %1$d! Kontakt oss på discord eller github for støtte
Alarminnstillinger
Velg dine foretrukne alarminnstillinger.
+ Varsel om pumpeadvarsel
+ Vis varsel om ikke-kritisk pumpeadvarsel: lavt batteri, lavt reservoar (20 enheter) og utløper snart. Anbefales og la være aktivert når pumpealarmer er satt til stillemodus.
Patch utløpsdato
Når aktivert vil plasteret utløpe etter 3 dager, med en nådeperiode på 8 timer etter det.
Maksimal insulin per time
diff --git a/pump/medtrum/src/main/res/values-nl-rNL/strings.xml b/pump/medtrum/src/main/res/values-nl-rNL/strings.xml
index aaaff5addd..a55cf9a280 100644
--- a/pump/medtrum/src/main/res/values-nl-rNL/strings.xml
+++ b/pump/medtrum/src/main/res/values-nl-rNL/strings.xml
@@ -6,6 +6,7 @@
Pomp integratie voor Medtrum Nano en Medtrum 300U
Medtrum pomp instellingen
Pomp fout: %1$s!!
+ Pomp waarschuwing: %1$s
Pomp is onderbroken
Pomp is onderbroken als gevolg van overschrijding max insuline per uur
Pomp is onderbroken als gevolg van overschrijding max insuline per dag
@@ -106,6 +107,7 @@
Pomp niet getest, %1$d! Neem contact met ons op via discord of github voor ondersteuning
Alarminstellingen
Selecteer uw gewenste alarminstellingen voor de pomp.
+ Notificatie bij pomp waarschuwing
Patch vervalt
Wanneer ingeschakeld, zal de patch na 3 dagen verlopen met een extra periode van 8 uur coulance.
Maximale insuline per uur
diff --git a/pump/medtrum/src/main/res/values-pl-rPL/strings.xml b/pump/medtrum/src/main/res/values-pl-rPL/strings.xml
index e1038fb4f1..ddccc09c6d 100644
--- a/pump/medtrum/src/main/res/values-pl-rPL/strings.xml
+++ b/pump/medtrum/src/main/res/values-pl-rPL/strings.xml
@@ -6,6 +6,7 @@
Integracja z pompami Medtrum Nano i Medtrum 300U
Ustawienia pompy Medtrum
Błąd pompy: %1$s!!
+ Ostrzeżenie pompy: %1$s
Pompa jest wstrzymana
Pompa jest wstrzymana z powodu przekroczenia maksymalnej godzinowej dawki insuliny
Pompa jest wstrzymana z powodu przekroczenia maksymalnej dziennej dawki insuliny
@@ -106,6 +107,8 @@
Pompa nieprzetestowana: %1$d! Skontaktuj się z nami na Discordzie lub github, aby uzyskać wsparcie
Ustawienia alarmu
Wybierz preferowaną konfigurację alarmu pompy.
+ Powiadomienie o ostrzeżeniu pompy
+ Pokaż powiadomienia o niekrytycznych ostrzeżeniach pompy takich jak: niski poziom baterii, niski poziom zbiornika (20 jednostek) i wkrótce wygasa. Zalecane zostawianie włączonych powiadomień, gdy alarmy pompy są wyciszone.
Wygaśnięcie Patcha
Po uruchomieniu Patch wygaśnie po 3 dniach, z dodatkowym 8 godzinowym okresem karencji.
Maksymalna Insulina w godzinę
diff --git a/pump/medtrum/src/main/res/values-ro-rRO/strings.xml b/pump/medtrum/src/main/res/values-ro-rRO/strings.xml
index 47001e16b9..1b55a6cc25 100644
--- a/pump/medtrum/src/main/res/values-ro-rRO/strings.xml
+++ b/pump/medtrum/src/main/res/values-ro-rRO/strings.xml
@@ -6,6 +6,7 @@
Integrarea pompei pentru Medtrum Nano și Medtrum 300U
Setări pompă Medtrum
Eroare pompă: %1$s!!
+ Avertizare pompă: %1$s
Pompă suspendată
Pompă suspendată din cauza depăşirii valorii maxime a insulinei pe oră
Pompă suspendată din cauza depăşirii valorii maxime zilnice a insulinei
@@ -106,6 +107,8 @@
Pompă netestată: %1$d! Te rugăm să ne contactezi pe discord sau github pentru suport.
Setări alarmă
Selectează setările preferate pentru alarma pompei.
+ Notificare la avertizarea pompei
+ Arată notificare cu privire la avertismentele non-critice ale pompei: baterie scăzută, rezervor redus (20 de unități) și expiră în curând. Se recomandă să lăsaţi activat când alarmele pompei sunt setate la silențios.
Patch Expirare
Când este activat, patchul va expira după 3 zile, cu o perioadă de graţie de 8 ore după expirare.
Insulină maximă pe oră
diff --git a/pump/medtrum/src/main/res/values-ru-rRU/strings.xml b/pump/medtrum/src/main/res/values-ru-rRU/strings.xml
index ea45cc70b4..533755408c 100644
--- a/pump/medtrum/src/main/res/values-ru-rRU/strings.xml
+++ b/pump/medtrum/src/main/res/values-ru-rRU/strings.xml
@@ -39,6 +39,8 @@
Приостановка на низкой ГК
Приостановка на низкой ГК 2
Автоматическая приостановка
+ почасовой максимальный приостановлен
+ суточный максимальный приостановлен
Приостановлено
На паузе
Окклюзия
@@ -68,6 +70,7 @@
Выполняется активация
Непредвиденное состояние: %1$s
Профиль не выбран. Выберите профиль и повторите попытку.
+ Серийный номер не известен. Введите серийный номер помпы в настройках и повторите попытку.
Серийный номер основания: %1$X
Активный патч отсутствует. Нажмите Далее для начала процесса активации.
Не соединяйте основание и патч до следующего шага!
diff --git a/pump/medtrum/src/main/res/values-sk-rSK/strings.xml b/pump/medtrum/src/main/res/values-sk-rSK/strings.xml
index 53c6a82b5d..45ced610f5 100644
--- a/pump/medtrum/src/main/res/values-sk-rSK/strings.xml
+++ b/pump/medtrum/src/main/res/values-sk-rSK/strings.xml
@@ -70,6 +70,7 @@
Aktivácia prebieha
Neočakávaný stav: %1$s
Žiadny vybraný profil. Prosím vyberte si profil a skúste to znovu.
+ Nie je zadané žiadne sériové číslo. Zadajte sériové číslo pumpy v nastaveniach a skúste to znova.
Sériové číslo základne pumpy: %1$X
Žiadny aktívny Patch. Stlačte Ďalšia pre zahájenie aktivačného procesu.
Základňa by nemala byť pripojená ku kanyle až do dalšieho kroku!
diff --git a/pump/medtrum/src/main/res/values/strings.xml b/pump/medtrum/src/main/res/values/strings.xml
index 147c018513..01bbe48505 100644
--- a/pump/medtrum/src/main/res/values/strings.xml
+++ b/pump/medtrum/src/main/res/values/strings.xml
@@ -4,6 +4,7 @@
sn_input
alarm_setting
patch_expiration
+ pump_warning_notification
hourly_max_insulin
daily_max_insulin
@@ -30,6 +31,7 @@
Pump integration for Medtrum Nano and Medtrum 300U
Medtrum pump settings
Pump error: %1$s !!
+ Pump warning: %1$s
Pump is suspended
Pump is suspended due to hourly max insulin exceeded
Pump is suspended due to daily max insulin exceeded
@@ -78,6 +80,7 @@
Battery out
No calibration
Failed to update pump timezone, snooze message and refresh manually.
+ Bolus error
Retry
@@ -132,12 +135,16 @@
Please wait, reading activation status from pump.
+ Unreachable alert forced enabled, because Medtrum patch can fail and be unreachable.
+ Advised to set to 30 minutes, because Medtrum patch can fail and be unreachable.
Serial Number
Enter the serial number of your pump base.
Invalid serial number!
Pump untested: %1$d! Please contact us at discord or github for support
Alarm Settings
Select your preferred pump alarm settings.
+ Notification on pump warning
+ Show notification on non critical pump warnings: low battery, low reservoir (20 units) and expires soon. Recommended to leave enabled when pump alarms are set to silent.
Patch Expiration
When enabled, the patch will expire after 3 days, with a grace period of 8 hours after that.
Hourly Maximum Insulin
diff --git a/pump/medtrum/src/main/res/xml/pref_medtrum_pump.xml b/pump/medtrum/src/main/res/xml/pref_medtrum_pump.xml
index 3e929bdcbb..4e4ff321ba 100644
--- a/pump/medtrum/src/main/res/xml/pref_medtrum_pump.xml
+++ b/pump/medtrum/src/main/res/xml/pref_medtrum_pump.xml
@@ -14,7 +14,7 @@
android:title="@string/sn_input_title" />
@@ -27,6 +27,12 @@
android:entries="@array/alarmSettings"
android:entryValues="@array/alarmSettingsValues" />
+
+
- Pod administrasjon
+ Pod-administrasjon
Handlinger
Verktøy
Aktiver Pod
@@ -105,10 +105,10 @@
DST/Tidssone-deteksjon aktivert
Utløpspåminnelse aktivert
Når aktivert, vil Pod\'en pipe når tidspunktet er nådd
- Påminelse før utløp (72 timer)
+ Påminnelse før utløp (72 timer)
Utløpspåminnelse aktivert
Når aktivert, vil Pod\'en pipe når tidspunktet er nådd og en time før nedstenging
- Påminelse før utløp (80 timer)
+ Påminnelse før utløp (80 timer)
Varsel om lavt reservoar aktivert
Antall enheter
Demp Pod-varsler automatisk
diff --git a/pump/omnipod-dash/src/main/res/values-no-rNO/strings.xml b/pump/omnipod-dash/src/main/res/values-nb-rNO/strings.xml
similarity index 100%
rename from pump/omnipod-dash/src/main/res/values-no-rNO/strings.xml
rename to pump/omnipod-dash/src/main/res/values-nb-rNO/strings.xml
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/endecrypt/EnDecryptTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/endecrypt/EnDecryptTest.kt
index fac539d635..eac55c8d88 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/endecrypt/EnDecryptTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/endecrypt/EnDecryptTest.kt
@@ -2,8 +2,8 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.endecry
import app.aaps.core.utils.toHex
import app.aaps.shared.tests.AAPSLoggerTest
+import com.google.common.truth.Truth.assertThat
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message.MessagePacket
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import org.spongycastle.util.encoders.Hex
@@ -32,7 +32,7 @@ import org.spongycastle.util.encoders.Hex
val msg = MessagePacket.parse(encryptedMessage)
val decryptedMsg = enDecrypt.decrypt(msg)
- Assertions.assertEquals(decrypted.toHex(), decryptedMsg.payload.toHex())
+ assertThat(decryptedMsg.payload.toHex()).isEqualTo(decrypted.toHex())
}
@Test
@@ -56,6 +56,6 @@ import org.spongycastle.util.encoders.Hex
val encrypted = enDecrypt.encrypt(msg)
- Assertions.assertEquals(encryptedMessage.toHex(), encrypted.asByteArray().toHex())
+ assertThat(encrypted.asByteArray().toHex()).isEqualTo(encryptedMessage.toHex())
}
}
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/MessagePacketTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/MessagePacketTest.kt
index 51a93579db..9df69de86d 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/MessagePacketTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/MessagePacketTest.kt
@@ -1,9 +1,9 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message
import app.aaps.core.utils.toHex
+import com.google.common.truth.Truth.assertThat
import com.google.crypto.tink.subtle.Hex
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.Id
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
class MessagePacketTest {
@@ -16,19 +16,19 @@ class MessagePacketTest {
@Test fun testParseMessagePacket() {
val msg = MessagePacket.parse(Hex.decode(payload))
- Assertions.assertEquals(msg.type, MessageType.ENCRYPTED)
- Assertions.assertEquals(msg.source, Id.fromLong(136326824))
- Assertions.assertEquals(msg.destination, Id.fromLong(136326825))
- Assertions.assertEquals(msg.sequenceNumber, 7.toByte())
- Assertions.assertEquals(msg.ackNumber, 0.toByte())
- Assertions.assertEquals(msg.eqos, 1.toShort())
- Assertions.assertEquals(msg.priority, false)
- Assertions.assertEquals(msg.lastMessage, false)
- Assertions.assertEquals(msg.gateway, false)
- Assertions.assertEquals(msg.sas, true)
- Assertions.assertEquals(msg.tfs, false)
- Assertions.assertEquals(msg.version, 0.toShort())
- Assertions.assertEquals(msg.payload.toHex(), payload.substring(32, payload.length))
+ assertThat(msg.type).isEqualTo(MessageType.ENCRYPTED)
+ assertThat(msg.source).isEqualTo(Id.fromLong(136326824))
+ assertThat(msg.destination).isEqualTo(Id.fromLong(136326825))
+ assertThat(msg.sequenceNumber).isEqualTo(7.toByte())
+ assertThat(msg.ackNumber).isEqualTo(0.toByte())
+ assertThat(msg.eqos).isEqualTo(1.toShort())
+ assertThat(msg.priority).isFalse()
+ assertThat(msg.lastMessage).isFalse()
+ assertThat(msg.gateway).isFalse()
+ assertThat(msg.sas).isTrue()
+ assertThat(msg.tfs).isFalse()
+ assertThat(msg.version).isEqualTo(0.toShort())
+ assertThat(payload.substring(32, payload.length)).isEqualTo(msg.payload.toHex())
}
@Test fun testSerializeMessagePacket() {
@@ -46,6 +46,6 @@ class MessagePacketTest {
tfs = false,
payload = Hex.decode(payload.substring(32, payload.length))
)
- Assertions.assertEquals(msg.asByteArray().toHex(), payload)
+ assertThat(msg.asByteArray().toHex()).isEqualTo(payload)
}
}
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/PayloadJoinerTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/PayloadJoinerTest.kt
index 983cfdb72f..c534618a2c 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/PayloadJoinerTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/PayloadJoinerTest.kt
@@ -1,9 +1,9 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message
import app.aaps.core.utils.toHex
+import com.google.common.truth.Truth.assertThat
import com.google.crypto.tink.subtle.Hex
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.packet.PayloadJoiner
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
class PayloadJoinerTest {
@@ -14,7 +14,7 @@ class PayloadJoinerTest {
val payload = "54,57,10,23,03,00,00,c0,ff,ff,ff,fe,08,20,2e,a8,50,30,3d,00,01,a5".replace(",", "")
val joiner = PayloadJoiner(f1)
joiner.accumulate(f2)
- val actual = joiner.finalize()
- Assertions.assertEquals(payload, actual.toHex())
+ val result = joiner.finalize()
+ assertThat(result.toHex()).isEqualTo(payload)
}
}
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/PayloadSplitJoinTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/PayloadSplitJoinTest.kt
index e37800a571..90b676a649 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/PayloadSplitJoinTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/PayloadSplitJoinTest.kt
@@ -1,9 +1,9 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message
import app.aaps.core.utils.toHex
+import com.google.common.truth.Truth.assertThat
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.packet.PayloadJoiner
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.packet.PayloadSplitter
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import java.util.Random
@@ -22,7 +22,7 @@ class PayloadSplitJoinTest {
joiner.accumulate(p.toByteArray())
}
val got = joiner.finalize()
- Assertions.assertEquals(got.toHex(), payload.toHex())
+ assertThat(got.toHex()).isEqualTo(payload.toHex())
}
}
}
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/StringLengthPrefixEncodingTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/StringLengthPrefixEncodingTest.kt
index 6379eaa702..005c0337d2 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/StringLengthPrefixEncodingTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/StringLengthPrefixEncodingTest.kt
@@ -1,8 +1,8 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message
import app.aaps.core.utils.toHex
+import com.google.common.truth.Truth.assertThat
import com.google.crypto.tink.subtle.Hex
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
class StringLengthPrefixEncodingTest {
@@ -12,12 +12,12 @@ class StringLengthPrefixEncodingTest {
@Test fun testFormatKeysP0() {
val payload = StringLengthPrefixEncoding.formatKeys(arrayOf("P0="), arrayOf(p0Content))
- Assertions.assertEquals(p0Payload.toHex(), payload.toHex())
+ assertThat(p0Payload.toHex()).isEqualTo(payload.toHex())
}
@Test fun testParseKeysP0() {
val parsed = StringLengthPrefixEncoding.parseKeys(arrayOf("P0="), p0Payload)
- Assertions.assertEquals(parsed.size, 1)
- Assertions.assertEquals(parsed[0].toHex(), p0Content.toHex())
+ assertThat(parsed).hasLength(1)
+ assertThat(parsed[0].toHex()).isEqualTo(p0Content.toHex())
}
}
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/KeyExchangeTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/KeyExchangeTest.kt
index e8a36c089c..0d73b2ce5c 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/KeyExchangeTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/pair/KeyExchangeTest.kt
@@ -4,9 +4,9 @@ import app.aaps.core.interfaces.configuration.Config
import app.aaps.core.utils.toHex
import app.aaps.shared.tests.AAPSLoggerTest
import app.aaps.shared.tests.TestBase
+import com.google.common.truth.Truth.assertThat
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.util.RandomByteGenerator
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.util.X25519KeyGenerator
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import org.mockito.ArgumentMatchers.anyInt
import org.mockito.Mock
@@ -20,7 +20,7 @@ class KeyExchangeTest : TestBase() {
private val keyGenerator = X25519KeyGenerator()
private val keyGeneratorSpy: X25519KeyGenerator = spy(keyGenerator)
- private var randomByteGenerator: RandomByteGenerator = mock(RandomByteGenerator::class.java)
+ private var randomByteGenerator = mock()
@Mock lateinit var config: Config
@@ -43,9 +43,9 @@ class KeyExchangeTest : TestBase() {
val podPublicKey = Hex.decode("2fe57da347cd62431528daac5fbb290730fff684afc4cfc2ed90995f58cb3b74")
val podNonce = Hex.decode("00000000000000000000000000000000")
ke.updatePodPublicData(podPublicKey + podNonce)
- Assertions.assertEquals(ke.pdmPublic.toHex(), "f2b6940243aba536a66e19fb9a39e37f1e76a1cd50ab59b3e05313b4fc93975e")
- Assertions.assertEquals(ke.pdmConf.toHex(), "5fc3b4da865e838ceaf1e9e8bb85d1ac")
+ assertThat("f2b6940243aba536a66e19fb9a39e37f1e76a1cd50ab59b3e05313b4fc93975e").isEqualTo(ke.pdmPublic.toHex())
+ assertThat("5fc3b4da865e838ceaf1e9e8bb85d1ac").isEqualTo(ke.pdmConf.toHex())
ke.validatePodConf(Hex.decode("af4f10db5f96e5d9cd6cfc1f54f4a92f"))
- Assertions.assertEquals(ke.ltk.toHex(), "341e16d13f1cbf73b19d1c2964fee02b")
+ assertThat("341e16d13f1cbf73b19d1c2964fee02b").isEqualTo(ke.ltk.toHex())
}
}
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/EapMessageTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/EapMessageTest.kt
index a17c03a276..92cd2282b3 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/EapMessageTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/EapMessageTest.kt
@@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.session
import app.aaps.core.utils.toHex
import app.aaps.shared.tests.AAPSLoggerTest
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.Test
import org.spongycastle.util.encoders.Hex
@@ -14,6 +14,6 @@ class EapMessageTest {
Hex.decode("01bd0038170100000205000000c55c78e8d3b9b9e935860a7259f6c001050000c2cd1248451103bd77a6c7ef88c441ba7e0200006cff5d18")
val eapMsg = EapMessage.parse(aapsLogger, payload)
val back = eapMsg.toByteArray()
- Assertions.assertEquals(back.toHex(), payload.toHex())
+ assertThat(payload.toHex()).isEqualTo(back.toHex())
}
}
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/MilenageTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/MilenageTest.kt
index 65152a5f36..847ce37927 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/MilenageTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/session/MilenageTest.kt
@@ -4,7 +4,7 @@ import app.aaps.core.interfaces.configuration.Config
import app.aaps.core.utils.toHex
import app.aaps.shared.tests.AAPSLoggerTest
import app.aaps.shared.tests.TestBase
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.Test
import org.mockito.Mock
import org.spongycastle.util.encoders.Hex
@@ -22,9 +22,9 @@ class MilenageTest : TestBase() {
sqn = byteArrayOf(0, 0, 0, 0, 0, 2),
randParam = Hex.decode("c2cd1248451103bd77a6c7ef88c441ba")
)
- Assertions.assertEquals(m.res.toHex(), "a40bc6d13861447e")
- Assertions.assertEquals(m.ck.toHex(), "55799fd26664cbf6e476525e2dee52c6")
- Assertions.assertEquals(m.autn.toHex(), "00c55c78e8d3b9b9e935860a7259f6c0")
+ assertThat(m.res.toHex()).isEqualTo("a40bc6d13861447e")
+ assertThat(m.ck.toHex()).isEqualTo("55799fd26664cbf6e476525e2dee52c6")
+ assertThat(m.autn.toHex()).isEqualTo("00c55c78e8d3b9b9e935860a7259f6c0")
}
@Test fun testMilenage2() {
@@ -36,9 +36,9 @@ class MilenageTest : TestBase() {
sqn = byteArrayOf(0, 0, 0, 0, 0, 2), // 1 + 1
randParam = Hex.decode("4fc01ac1a94376ae3e052339c07d9e1f")
)
- Assertions.assertEquals(m.res.toHex(), "ec549e00fa668a19")
- Assertions.assertEquals(m.ck.toHex(), "ee3dac761fe358a9f476cc5ee81aa3e9")
- Assertions.assertEquals(m.autn.toHex(), "a3e7a71430c8b9b95245b33b3bd679c4")
+ assertThat(m.res.toHex()).isEqualTo("ec549e00fa668a19")
+ assertThat(m.ck.toHex()).isEqualTo("ee3dac761fe358a9f476cc5ee81aa3e9")
+ assertThat(m.autn.toHex()).isEqualTo("a3e7a71430c8b9b95245b33b3bd679c4")
}
@Test fun testMilenageIncrementedSQN() {
@@ -51,9 +51,9 @@ class MilenageTest : TestBase() {
sqn = byteArrayOf(0, 0, 0, 0, 0x01, 0x5e),
randParam = Hex.decode("d71cc44820e5419f42c62ae97c035988")
)
- Assertions.assertEquals(m.res.toHex(), "5f807a379a5c5d30")
- Assertions.assertEquals(m.ck.toHex(), "8dd4b3ceb849a01766e37f9d86045c39")
- Assertions.assertEquals(m.autn.toHex(), "0e0264d056fcb9b9752227365a090955")
+ assertThat(m.res.toHex()).isEqualTo("5f807a379a5c5d30")
+ assertThat(m.ck.toHex()).isEqualTo("8dd4b3ceb849a01766e37f9d86045c39")
+ assertThat(m.autn.toHex()).isEqualTo("0e0264d056fcb9b9752227365a090955")
}
@Test fun testMileageSynchronization() {
@@ -67,7 +67,7 @@ class MilenageTest : TestBase() {
randParam = Hex.decode("396707041ca3a5931fc0e52d2d7b9ecf"),
amf = byteArrayOf(0, 0),
)
- Assertions.assertEquals(m.receivedMacS.toHex(), m.macS.toHex())
- Assertions.assertEquals(m.sqn.toHex(), m.synchronizationSqn.toHex())
+ assertThat(m.receivedMacS.toHex()).isEqualTo(m.macS.toHex())
+ assertThat(m.sqn.toHex()).isEqualTo(m.synchronizationSqn.toHex())
}
}
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/DeactivateCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/DeactivateCommandTest.kt
index 1c74df813f..db10dc0d41 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/DeactivateCommandTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/DeactivateCommandTest.kt
@@ -1,13 +1,12 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command
-import org.apache.commons.codec.DecoderException
+import com.google.common.truth.Truth.assertThat
import org.apache.commons.codec.binary.Hex
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
class DeactivateCommandTest {
- @Test @Throws(DecoderException::class) fun testEncoding() {
+ @Test fun testEncoding() {
val encoded = DeactivateCommand.Builder()
.setUniqueId(37879809)
.setSequenceNumber(5.toShort())
@@ -15,6 +14,6 @@ class DeactivateCommandTest {
.build()
.encoded
- Assertions.assertArrayEquals(Hex.decodeHex("0242000114061C04494E532E001C"), encoded)
+ assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex("0242000114061C04494E532E001C").asList()).inOrder()
}
}
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetStatusCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetStatusCommandTest.kt
index d149f51161..33195bfa8b 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetStatusCommandTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetStatusCommandTest.kt
@@ -1,14 +1,13 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command
+import com.google.common.truth.Truth.assertThat
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.ResponseType
-import org.apache.commons.codec.DecoderException
import org.apache.commons.codec.binary.Hex
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
class GetStatusCommandTest {
- @Test @Throws(DecoderException::class) fun testGetDefaultStatusResponse() {
+ @Test fun testGetDefaultStatusResponse() {
val encoded = GetStatusCommand.Builder()
.setUniqueId(37879810)
.setSequenceNumber(15.toShort())
@@ -16,6 +15,6 @@ class GetStatusCommandTest {
.build()
.encoded
- Assertions.assertArrayEquals(Hex.decodeHex("024200023C030E0100024C"), encoded)
+ assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex("024200023C030E0100024C").asList()).inOrder()
}
}
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetVersionCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetVersionCommandTest.kt
index d3f66e68c0..dd7ab87763 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetVersionCommandTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetVersionCommandTest.kt
@@ -1,19 +1,18 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command
-import org.apache.commons.codec.DecoderException
+import com.google.common.truth.Truth.assertThat
import org.apache.commons.codec.binary.Hex
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
class GetVersionCommandTest {
- @Test @Throws(DecoderException::class) fun testEncoding() {
+ @Test fun testEncoding() {
val encoded = GetVersionCommand.Builder()
.setSequenceNumber(0.toShort())
.setUniqueId(GetVersionCommand.DEFAULT_UNIQUE_ID)
.build()
.encoded
- Assertions.assertArrayEquals(Hex.decodeHex("FFFFFFFF00060704FFFFFFFF82B2"), encoded)
+ assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex("FFFFFFFF00060704FFFFFFFF82B2").asList()).inOrder()
}
}
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramAlertsCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramAlertsCommandTest.kt
index 2497e8c74b..c77469c636 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramAlertsCommandTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramAlertsCommandTest.kt
@@ -1,18 +1,17 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command
+import com.google.common.truth.Truth.assertThat
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlertConfiguration
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlertTrigger
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlertType
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.BeepRepetitionType
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.BeepType
-import org.apache.commons.codec.DecoderException
import org.apache.commons.codec.binary.Hex
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
class ProgramAlertsCommandTest {
- @Test @Throws(DecoderException::class) fun testExpirationAlerts() {
+ @Test fun testExpirationAlerts() {
val configurations: MutableList = ArrayList()
configurations.add(
AlertConfiguration(
@@ -46,10 +45,10 @@ class ProgramAlertsCommandTest {
.build()
.encoded
- Assertions.assertArrayEquals(Hex.decodeHex("024200038C121910494E532E79A410D1050228001275060280F5"), encoded)
+ assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex("024200038C121910494E532E79A410D1050228001275060280F5").asList()).inOrder()
}
- @Test @Throws(DecoderException::class) fun testLowReservoirAlert() {
+ @Test fun testLowReservoirAlert() {
val configurations: MutableList = ArrayList()
configurations.add(
AlertConfiguration(
@@ -71,10 +70,10 @@ class ProgramAlertsCommandTest {
.build()
.encoded
- Assertions.assertArrayEquals(Hex.decodeHex("02420003200C190A494E532E4C0000C801020149"), encoded)
+ assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex("02420003200C190A494E532E4C0000C801020149").asList()).inOrder()
}
- @Test @Throws(DecoderException::class) fun testUserExpirationAlert() {
+ @Test fun testUserExpirationAlert() {
val configurations: MutableList = ArrayList()
configurations.add(
AlertConfiguration(
@@ -96,10 +95,10 @@ class ProgramAlertsCommandTest {
.build()
.encoded
- Assertions.assertArrayEquals(Hex.decodeHex("024200033C0C190A494E532E38000FEF030203E2"), encoded)
+ assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex("024200033C0C190A494E532E38000FEF030203E2").asList()).inOrder()
}
- @Test @Throws(DecoderException::class) fun testLumpOfCoalAlert() {
+ @Test fun testLumpOfCoalAlert() {
val configurations: MutableList = ArrayList()
configurations.add(
AlertConfiguration(
@@ -122,6 +121,6 @@ class ProgramAlertsCommandTest {
.build()
.encoded
- Assertions.assertArrayEquals(Hex.decodeHex("02420003280C190A494E532E7837000508020356"), encoded)
+ assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex("02420003280C190A494E532E7837000508020356").asList()).inOrder()
}
}
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBasalCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBasalCommandTest.kt
index b988e45e4f..09c6feaade 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBasalCommandTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBasalCommandTest.kt
@@ -1,17 +1,16 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command
+import com.google.common.truth.Truth.assertThat
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.BasalProgram
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.ProgramReminder
-import org.apache.commons.codec.DecoderException
import org.apache.commons.codec.binary.Hex
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import java.util.Date
@Suppress("DEPRECATION")
class ProgramBasalCommandTest {
- @Test @Throws(DecoderException::class) fun testProgramBasalCommand() {
+ @Test fun testProgramBasalCommand() {
val segments = listOf(
BasalProgram.Segment(0.toShort(), 48.toShort(), 300)
)
@@ -28,13 +27,10 @@ class ProgramBasalCommandTest {
.build()
.encoded
- Assertions.assertArrayEquals(
- Hex.decodeHex("0242000128241A12494E532E0005E81D1708000CF01EF01EF01E130E40001593004C4B403840005B8D80827C"),
- encoded
- )
+ assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex("0242000128241A12494E532E0005E81D1708000CF01EF01EF01E130E40001593004C4B403840005B8D80827C").asList()).inOrder()
}
- @Test @Throws(DecoderException::class) fun testProgramBasalCommandWithExtraAlternateSegmentPulse() {
+ @Test fun testProgramBasalCommandWithExtraAlternateSegmentPulse() {
val segments = listOf(
BasalProgram.Segment(0.toShort(), 48.toShort(), 5)
)
@@ -51,13 +47,10 @@ class ProgramBasalCommandTest {
.build()
.encoded
- Assertions.assertArrayEquals(
- Hex.decodeHex("0000109130241a12494e532e0000c52e0f700000f800f800f800130e0000000707fcad8000f015752a00033b"),
- encoded
- )
+ assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex("0000109130241a12494e532e0000c52e0f700000f800f800f800130e0000000707fcad8000f015752a00033b").asList()).inOrder()
}
- @Test @Throws(DecoderException::class) fun testProgramBasalCommandAllSegments() {
+ @Test fun testProgramBasalCommandAllSegments() {
val segments = mutableListOf()
for (segment in 0..23) {
val rate = when (segment) {
@@ -95,15 +88,10 @@ class ProgramBasalCommandTest {
val expected =
"0000000508C41A28494E532E00018B16273000032000300130023003300430053006300730083009200A100B100C180D1398400B005E009E22E80002EB49D200000A15752A0000140ABA9500001E07270E000028055D4A800032044AA200003C0393870000460310BCDB005002AEA540005A02625A00006402255100006E01F360E8007801C9C380008201A68D13008C01885E6D0096016E360000A0015752A000AA0143209600B401312D0000BE01211D2800C80112A88000DC00F9B07400F000E4E1C0010E00CB73558158".lowercase()
- Assertions.assertArrayEquals(
- Hex.decodeHex(
- expected
- ),
- encoded
- )
+ assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex(expected).asList()).inOrder()
}
- @Test @Throws(DecoderException::class) fun testProgramBasalCommandHighRates() {
+ @Test fun testProgramBasalCommandHighRates() {
val segments = listOf(
BasalProgram.Segment(0.toShort(), 2.toShort(), 300),
BasalProgram.Segment(2.toShort(), 4.toShort(), 290),
@@ -140,15 +128,10 @@ class ProgramBasalCommandTest {
val expected =
"000000051C981A2C494E532E00046D162178000B101E101D101C101B101A301938173816101458123810380E300D180B100A180613684008013F008954400258005B8D800244005EB5B002300062179B021C0065B9AA02080069A34403E8006DDD0003AC0074E0360384007A12000190008954400456009476C1029400A675A2024400BD6B61020800D3468900E600EED54D00C80112A880008201A68D13809b"
- Assertions.assertArrayEquals(
- Hex.decodeHex(
- expected
- ),
- encoded
- )
+ assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex(expected).asList()).inOrder()
}
- @Test @Throws(DecoderException::class) fun testProgramBasalCommandDifferentInterval() {
+ @Test fun testProgramBasalCommandDifferentInterval() {
val segments = listOf(
BasalProgram.Segment(0.toShort(), 2.toShort(), 50),
BasalProgram.Segment(2.toShort(), 6.toShort(), 75),
@@ -177,11 +160,6 @@ class ProgramBasalCommandTest {
val expected =
"0000000528581A1C494E532E00038E161E50000E100538075000780DB01B701D58091801133840040A100032DC82006402255100012C016E36000006EB49D200043800CB73550CA80065B9AA0910005EB5B0023A01211D28001E07270E000065"
- Assertions.assertArrayEquals(
- Hex.decodeHex(
- expected
- ),
- encoded
- )
+ assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex(expected).asList()).inOrder()
}
}
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBeepsCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBeepsCommandTest.kt
index 6695c10155..9bc59e20bc 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBeepsCommandTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBeepsCommandTest.kt
@@ -1,15 +1,14 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command
+import com.google.common.truth.Truth.assertThat
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.BeepType
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.ProgramReminder
-import org.apache.commons.codec.DecoderException
import org.apache.commons.codec.binary.Hex
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
class ProgramBeepsCommandTest {
- @Test @Throws(DecoderException::class) fun testPlayTestBeep() {
+ @Test fun testPlayTestBeep() {
val encoded = ProgramBeepsCommand.Builder()
.setUniqueId(37879810)
.setSequenceNumber(11.toShort())
@@ -20,6 +19,6 @@ class ProgramBeepsCommandTest {
.build()
.encoded
- Assertions.assertArrayEquals(Hex.decodeHex("024200022C061E0402000000800F"), encoded)
+ assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex("024200022C061E0402000000800F").asList()).inOrder()
}
}
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBolusCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBolusCommandTest.kt
index 2bca8a864b..16d1268792 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBolusCommandTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBolusCommandTest.kt
@@ -1,14 +1,13 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command
+import com.google.common.truth.Truth.assertThat
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.ProgramReminder
-import org.apache.commons.codec.DecoderException
import org.apache.commons.codec.binary.Hex
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
class ProgramBolusCommandTest {
- @Test @Throws(DecoderException::class) fun testProgramBolusCommand() {
+ @Test fun testProgramBolusCommand() {
val encoded = ProgramBolusCommand.Builder()
.setNumberOfUnits(5.0)
.setProgramReminder(ProgramReminder(false, true, 0.toByte()))
@@ -19,9 +18,6 @@ class ProgramBolusCommandTest {
.build()
.encoded
- Assertions.assertArrayEquals(
- Hex.decodeHex("02420001381F1A0E494E532E02010F01064000640064170D4003E800030D4000000000000080F6"),
- encoded
- )
+ assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex("02420001381F1A0E494E532E02010F01064000640064170D4003E800030D4000000000000080F6").asList()).inOrder()
}
}
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramTempBasalCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramTempBasalCommandTest.kt
index a5222f611f..c0e9593c1a 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramTempBasalCommandTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramTempBasalCommandTest.kt
@@ -1,14 +1,14 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command
+import com.google.common.truth.Truth.assertThat
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.ProgramReminder
import org.apache.commons.codec.DecoderException
import org.apache.commons.codec.binary.Hex
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
class ProgramTempBasalCommandTest {
- @Test @Throws(DecoderException::class) fun testExtraAlternateSegmentPulseTempBasal() {
+ @Test fun testExtraAlternateSegmentPulseTempBasal() {
val command = ProgramTempBasalCommand.Builder()
.setUniqueId(37879809)
.setNonce(1229869870)
@@ -18,13 +18,10 @@ class ProgramTempBasalCommandTest {
.setProgramReminder(ProgramReminder(atStart = false, atEnd = true, atInterval = 0.toByte()))
.build()
- Assertions.assertArrayEquals(
- Hex.decodeHex("024200013C201A0E494E532E01011102384000321832160E400003F20036634403F20036634482A6"),
- command.encoded
- )
+ assertThat(command.encoded).asList().containsExactlyElementsIn(Hex.decodeHex("024200013C201A0E494E532E01011102384000321832160E400003F20036634403F20036634482A6").asList()).inOrder()
}
- @Test @Throws(DecoderException::class) fun testZeroTempBasal() {
+ @Test fun testZeroTempBasal() {
val command = ProgramTempBasalCommand.Builder()
.setUniqueId(37879809)
.setNonce(1229869870)
@@ -34,13 +31,10 @@ class ProgramTempBasalCommandTest {
.setProgramReminder(ProgramReminder(atStart = true, atEnd = true, atInterval = 0.toByte()))
.build()
- Assertions.assertArrayEquals(
- Hex.decodeHex("024200011C201A0E494E532E0100820A384000009000160EC000000A6B49D200000A6B49D20001E3"),
- command.encoded
- )
+ assertThat(command.encoded).asList().containsExactlyElementsIn(Hex.decodeHex("024200011C201A0E494E532E0100820A384000009000160EC000000A6B49D200000A6B49D20001E3").asList()).inOrder()
}
- @Test @Throws(DecoderException::class) fun testZeroTempBasalShort() {
+ @Test fun testZeroTempBasalShort() {
val command = ProgramTempBasalCommand.Builder()
.setUniqueId(37879809)
.setNonce(1229869870)
@@ -50,13 +44,10 @@ class ProgramTempBasalCommandTest {
.setProgramReminder(ProgramReminder(atStart = true, atEnd = true, atInterval = 0.toByte()))
.build()
- Assertions.assertArrayEquals(
- Hex.decodeHex("024200011C201A0E494E532E01007901384000000000160EC00000016B49D2000001EB49D200815B"),
- command.encoded
- )
+ assertThat(command.encoded).asList().containsExactlyElementsIn(Hex.decodeHex("024200011C201A0E494E532E01007901384000000000160EC00000016B49D2000001EB49D200815B").asList()).inOrder()
}
- @Test @Throws(DecoderException::class) fun testZeroTempBasalVeryLong() {
+ @Test fun testZeroTempBasalVeryLong() {
val command = ProgramTempBasalCommand.Builder()
.setUniqueId(37879809)
.setNonce(1229869870)
@@ -66,9 +57,6 @@ class ProgramTempBasalCommandTest {
.setProgramReminder(ProgramReminder(atStart = true, atEnd = true, atInterval = 0.toByte()))
.build()
- Assertions.assertArrayEquals(
- Hex.decodeHex("024200011C221A10494E532E0100901838400000F0007000160EC00000186B49D20000186B49D2000132"),
- command.encoded
- )
+ assertThat(command.encoded).asList().containsExactlyElementsIn(Hex.decodeHex("024200011C221A10494E532E0100901838400000F0007000160EC00000186B49D20000186B49D2000132").asList()).inOrder()
}
}
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SetUniqueIdCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SetUniqueIdCommandTest.kt
index b47b52aa41..1dbdfbc75d 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SetUniqueIdCommandTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SetUniqueIdCommandTest.kt
@@ -1,14 +1,13 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command
-import org.apache.commons.codec.DecoderException
+import com.google.common.truth.Truth.assertThat
import org.apache.commons.codec.binary.Hex
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import java.util.Date
class SetUniqueIdCommandTest {
- @Test @Throws(DecoderException::class) fun testEncoding() {
+ @Test fun testEncoding() {
@Suppress("DEPRECATION") val encoded = SetUniqueIdCommand.Builder()
.setUniqueId(37879811)
.setSequenceNumber(6.toShort())
@@ -18,6 +17,6 @@ class SetUniqueIdCommandTest {
.build()
.encoded
- Assertions.assertArrayEquals(Hex.decodeHex("FFFFFFFF18150313024200031404020A150E2908146CC1000A67278344"), encoded)
+ assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex("FFFFFFFF18150313024200031404020A150E2908146CC1000A67278344").asList()).inOrder()
}
}
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SilenceAlertsCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SilenceAlertsCommandTest.kt
index 64884e99dc..8360adddba 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SilenceAlertsCommandTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SilenceAlertsCommandTest.kt
@@ -1,15 +1,14 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command
+import com.google.common.truth.Truth.assertThat
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlertType
-import org.apache.commons.codec.DecoderException
import org.apache.commons.codec.binary.Hex
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import java.util.EnumSet
class SilenceAlertsCommandTest {
- @Test @Throws(DecoderException::class) fun testSilenceLowReservoirAlert() {
+ @Test fun testSilenceLowReservoirAlert() {
val encoded = SilenceAlertsCommand.Builder()
.setUniqueId(37879811)
.setSequenceNumber(1.toShort())
@@ -18,7 +17,7 @@ class SilenceAlertsCommandTest {
.build()
.encoded
- Assertions.assertArrayEquals(Hex.decodeHex("0242000304071105494E532E1081CE"), encoded)
+ assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex("0242000304071105494E532E1081CE").asList()).inOrder()
}
// TODO capture more silence alerts commands
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/StopDeliveryCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/StopDeliveryCommandTest.kt
index e0dac98b34..01ce8b0000 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/StopDeliveryCommandTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/StopDeliveryCommandTest.kt
@@ -1,14 +1,13 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command
+import com.google.common.truth.Truth.assertThat
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.BeepType
-import org.apache.commons.codec.DecoderException
import org.apache.commons.codec.binary.Hex
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
class StopDeliveryCommandTest {
- @Test @Throws(DecoderException::class) fun testStopTempBasal() {
+ @Test fun testStopTempBasal() {
val encoded = StopDeliveryCommand.Builder()
.setUniqueId(37879811)
.setSequenceNumber(0.toShort())
@@ -18,10 +17,10 @@ class StopDeliveryCommandTest {
.build()
.encoded
- Assertions.assertArrayEquals(Hex.decodeHex("0242000300071F05494E532E6201B1"), encoded)
+ assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex("0242000300071F05494E532E6201B1").asList()).inOrder()
}
- @Test @Throws(DecoderException::class) fun testSuspendDelivery() {
+ @Test fun testSuspendDelivery() {
val encoded = StopDeliveryCommand.Builder()
.setUniqueId(37879811)
.setSequenceNumber(2.toShort())
@@ -31,7 +30,7 @@ class StopDeliveryCommandTest {
.build()
.encoded
- Assertions.assertArrayEquals(Hex.decodeHex("0242000308071F05494E532E078287"), encoded)
+ assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex("0242000308071F05494E532E078287").asList()).inOrder()
}
// TODO test cancel bolus
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SuspendDeliveryCommandTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SuspendDeliveryCommandTest.kt
index ba53dc84b2..8787f2a0f1 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SuspendDeliveryCommandTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SuspendDeliveryCommandTest.kt
@@ -1,14 +1,13 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command
+import com.google.common.truth.Truth.assertThat
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.BeepType
-import org.apache.commons.codec.DecoderException
import org.apache.commons.codec.binary.Hex
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
class SuspendDeliveryCommandTest {
- @Test @Throws(DecoderException::class) fun testSuspendDelivery() {
+ @Test fun testSuspendDelivery() {
val encoded = SuspendDeliveryCommand.Builder()
.setUniqueId(37879811)
.setSequenceNumber(0.toShort())
@@ -16,6 +15,6 @@ class SuspendDeliveryCommandTest {
.setBeepType(BeepType.LONG_SINGLE_BEEP)
.build()
.encoded
- Assertions.assertArrayEquals(Hex.decodeHex("0242000300131f05494e532e67190a494e532e680000140302811f"), encoded)
+ assertThat(encoded).asList().containsExactlyElementsIn(Hex.decodeHex("0242000300131f05494e532e67190a494e532e680000140302811f").asList()).inOrder()
}
}
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/AlarmStatusResponseTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/AlarmStatusResponseTest.kt
index 605d7043e9..9428a081f2 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/AlarmStatusResponseTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/AlarmStatusResponseTest.kt
@@ -1,44 +1,44 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response
+import com.google.common.truth.Truth.assertThat
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlarmType
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.DeliveryStatus
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodStatus
import org.apache.commons.codec.DecoderException
import org.apache.commons.codec.binary.Hex
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
class AlarmStatusResponseTest {
- @Test @Throws(DecoderException::class) fun testValidResponse() {
+ @Test fun testValidResponse() {
val encoded = Hex.decodeHex("021602080100000501BD00000003FF01950000000000670A")
val response = AlarmStatusResponse(encoded)
- Assertions.assertArrayEquals(encoded, response.encoded)
- Assertions.assertNotSame(encoded, response.encoded)
- Assertions.assertEquals(ResponseType.ADDITIONAL_STATUS_RESPONSE, response.responseType)
- Assertions.assertEquals(ResponseType.ADDITIONAL_STATUS_RESPONSE.value, response.messageType)
- Assertions.assertEquals(ResponseType.StatusResponseType.ALARM_STATUS, response.statusResponseType)
- Assertions.assertEquals(ResponseType.StatusResponseType.ALARM_STATUS.value, response.additionalStatusResponseType)
- Assertions.assertEquals(PodStatus.RUNNING_ABOVE_MIN_VOLUME, response.podStatus)
- Assertions.assertEquals(DeliveryStatus.BASAL_ACTIVE, response.deliveryStatus)
- Assertions.assertEquals(0.toShort(), response.bolusPulsesRemaining)
- Assertions.assertEquals(5.toShort(), response.sequenceNumberOfLastProgrammingCommand)
- Assertions.assertEquals(445.toShort(), response.totalPulsesDelivered)
- Assertions.assertEquals(AlarmType.NONE, response.alarmType)
- Assertions.assertEquals(0.toShort(), response.alarmTime)
- Assertions.assertEquals(1023.toShort(), response.reservoirPulsesRemaining)
- Assertions.assertEquals(405.toShort(), response.minutesSinceActivation)
- Assertions.assertEquals(0, response.activeAlerts.size)
- Assertions.assertFalse(response.occlusionAlarm)
- Assertions.assertFalse(response.pulseInfoInvalid)
- Assertions.assertEquals(PodStatus.UNINITIALIZED, response.podStatusWhenAlarmOccurred)
- Assertions.assertFalse(response.immediateBolusWhenAlarmOccurred)
- Assertions.assertEquals(0x00.toByte(), response.occlusionType)
- Assertions.assertFalse(response.occurredWhenFetchingImmediateBolusActiveInformation)
- Assertions.assertEquals(0.toShort(), response.rssi)
- Assertions.assertEquals(0.toShort(), response.receiverLowerGain)
- Assertions.assertEquals(PodStatus.UNINITIALIZED, response.podStatusWhenAlarmOccurred2)
- Assertions.assertEquals(26378.toShort(), response.returnAddressOfPodAlarmHandlerCaller)
+ assertThat(response.encoded).asList().containsExactlyElementsIn(encoded.asList()).inOrder()
+ assertThat(response.encoded).isNotSameInstanceAs(encoded)
+ assertThat(response.responseType).isEqualTo(ResponseType.ADDITIONAL_STATUS_RESPONSE)
+ assertThat(response.messageType).isEqualTo(ResponseType.ADDITIONAL_STATUS_RESPONSE.value)
+ assertThat(response.statusResponseType).isEqualTo(ResponseType.StatusResponseType.ALARM_STATUS)
+ assertThat(response.additionalStatusResponseType).isEqualTo(ResponseType.StatusResponseType.ALARM_STATUS.value)
+ assertThat(response.podStatus).isEqualTo(PodStatus.RUNNING_ABOVE_MIN_VOLUME)
+ assertThat(response.deliveryStatus).isEqualTo(DeliveryStatus.BASAL_ACTIVE)
+ assertThat(response.bolusPulsesRemaining).isEqualTo(0.toShort())
+ assertThat(response.sequenceNumberOfLastProgrammingCommand).isEqualTo(5.toShort())
+ assertThat(response.totalPulsesDelivered).isEqualTo(445.toShort())
+ assertThat(response.alarmType).isEqualTo(AlarmType.NONE)
+ assertThat(response.alarmTime).isEqualTo(0.toShort())
+ assertThat(response.reservoirPulsesRemaining).isEqualTo(1023.toShort())
+ assertThat(response.minutesSinceActivation).isEqualTo(405.toShort())
+ assertThat(response.activeAlerts.size).isEqualTo(0)
+ assertThat(response.occlusionAlarm).isFalse()
+ assertThat(response.pulseInfoInvalid).isFalse()
+ assertThat(response.podStatusWhenAlarmOccurred).isEqualTo(PodStatus.UNINITIALIZED)
+ assertThat(response.immediateBolusWhenAlarmOccurred).isFalse()
+ assertThat(response.occlusionType).isEqualTo(0x00.toByte())
+ assertThat(response.occurredWhenFetchingImmediateBolusActiveInformation).isFalse()
+ assertThat(response.rssi).isEqualTo(0.toShort())
+ assertThat(response.receiverLowerGain).isEqualTo(0.toShort())
+ assertThat(response.podStatusWhenAlarmOccurred2).isEqualTo(PodStatus.UNINITIALIZED)
+ assertThat(response.returnAddressOfPodAlarmHandlerCaller).isEqualTo(26378.toShort())
}
}
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/DefaultStatusResponseTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/DefaultStatusResponseTest.kt
index 9d847eefe6..200567566c 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/DefaultStatusResponseTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/DefaultStatusResponseTest.kt
@@ -1,30 +1,30 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response
+import com.google.common.truth.Truth.assertThat
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlertType
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.DeliveryStatus
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodStatus
import org.apache.commons.codec.DecoderException
import org.apache.commons.codec.binary.Hex
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
class DefaultStatusResponseTest {
- @Test @Throws(DecoderException::class) fun testValidResponse() {
+ @Test fun testValidResponse() {
val encoded = Hex.decodeHex("1D1800A02800000463FF")
val response = DefaultStatusResponse(encoded)
- Assertions.assertArrayEquals(encoded, response.encoded)
- Assertions.assertNotSame(encoded, response.encoded)
- Assertions.assertEquals(ResponseType.DEFAULT_STATUS_RESPONSE, response.responseType)
- Assertions.assertEquals(ResponseType.DEFAULT_STATUS_RESPONSE.value, response.messageType)
- Assertions.assertEquals(DeliveryStatus.BASAL_ACTIVE, response.deliveryStatus)
- Assertions.assertEquals(PodStatus.RUNNING_ABOVE_MIN_VOLUME, response.podStatus)
- Assertions.assertEquals(320.toShort(), response.totalPulsesDelivered)
- Assertions.assertEquals(5.toShort(), response.sequenceNumberOfLastProgrammingCommand)
- Assertions.assertEquals(0.toShort(), response.bolusPulsesRemaining)
- Assertions.assertEquals(0, response.activeAlerts.size)
- Assertions.assertEquals(280.toShort(), response.minutesSinceActivation)
- Assertions.assertEquals(1023.toShort(), response.reservoirPulsesRemaining)
+ assertThat(response.encoded).asList().containsExactlyElementsIn(encoded.asList())
+ assertThat(response.encoded).isNotSameInstanceAs(encoded)
+ assertThat(response.responseType).isEqualTo(ResponseType.DEFAULT_STATUS_RESPONSE)
+ assertThat(response.messageType).isEqualTo(ResponseType.DEFAULT_STATUS_RESPONSE.value)
+ assertThat(response.deliveryStatus).isEqualTo(DeliveryStatus.BASAL_ACTIVE)
+ assertThat(response.podStatus).isEqualTo(PodStatus.RUNNING_ABOVE_MIN_VOLUME)
+ assertThat(response.totalPulsesDelivered).isEqualTo(320.toShort())
+ assertThat(response.sequenceNumberOfLastProgrammingCommand).isEqualTo(5.toShort())
+ assertThat(response.bolusPulsesRemaining).isEqualTo(0.toShort())
+ assertThat(response.activeAlerts).isEmpty()
+ assertThat(response.minutesSinceActivation).isEqualTo(280.toShort())
+ assertThat(response.reservoirPulsesRemaining).isEqualTo(1023.toShort())
}
/**
@@ -49,21 +49,21 @@ class DefaultStatusResponseTest {
Alert 7 is InActive
Occlusion alert active false
*/
- @Test @Throws(DecoderException::class) fun testValidResponseBelowMin() {
+ @Test fun testValidResponseBelowMin() {
val encoded = Hex.decodeHex("1D1905281000004387D3039A")
val response = DefaultStatusResponse(encoded)
- Assertions.assertArrayEquals(encoded, response.encoded)
- Assertions.assertNotSame(encoded, response.encoded)
- Assertions.assertEquals(ResponseType.DEFAULT_STATUS_RESPONSE, response.responseType)
- Assertions.assertEquals(ResponseType.DEFAULT_STATUS_RESPONSE.value, response.messageType)
- Assertions.assertEquals(DeliveryStatus.BASAL_ACTIVE, response.deliveryStatus)
- Assertions.assertEquals(PodStatus.RUNNING_BELOW_MIN_VOLUME, response.podStatus)
- Assertions.assertEquals(2.toShort(), response.sequenceNumberOfLastProgrammingCommand)
- Assertions.assertEquals(0.toShort(), response.bolusPulsesRemaining)
- Assertions.assertEquals(0, response.activeAlerts.size)
- Assertions.assertEquals(4321.toShort(), response.minutesSinceActivation)
- Assertions.assertEquals(979.toShort(), response.reservoirPulsesRemaining)
- Assertions.assertEquals(2640.toShort(), response.totalPulsesDelivered)
+ assertThat(response.encoded).asList().containsExactlyElementsIn(encoded.asList()).inOrder()
+ assertThat(response.encoded).isNotSameInstanceAs(encoded)
+ assertThat(response.responseType).isEqualTo(ResponseType.DEFAULT_STATUS_RESPONSE)
+ assertThat(response.messageType).isEqualTo(ResponseType.DEFAULT_STATUS_RESPONSE.value)
+ assertThat(response.deliveryStatus).isEqualTo(DeliveryStatus.BASAL_ACTIVE)
+ assertThat(response.podStatus).isEqualTo(PodStatus.RUNNING_BELOW_MIN_VOLUME)
+ assertThat(response.sequenceNumberOfLastProgrammingCommand).isEqualTo(2.toShort())
+ assertThat(response.bolusPulsesRemaining).isEqualTo(0.toShort())
+ assertThat(response.activeAlerts).isEmpty()
+ assertThat(response.minutesSinceActivation).isEqualTo(4321.toShort())
+ assertThat(response.reservoirPulsesRemaining).isEqualTo(979.toShort())
+ assertThat(response.totalPulsesDelivered).isEqualTo(2640.toShort())
}
/**
@@ -88,21 +88,21 @@ class DefaultStatusResponseTest {
Alert 7 is InActive
Occlusion alert active false
*/
- @Test @Throws(DecoderException::class) fun testValidResponseBolusPulsesRemaining() {
+ @Test fun testValidResponseBolusPulsesRemaining() {
val encoded = Hex.decodeHex("1D180519C00E0039A7FF8085")
val response = DefaultStatusResponse(encoded)
- Assertions.assertArrayEquals(encoded, response.encoded)
- Assertions.assertNotSame(encoded, response.encoded)
- Assertions.assertEquals(ResponseType.DEFAULT_STATUS_RESPONSE, response.responseType)
- Assertions.assertEquals(ResponseType.DEFAULT_STATUS_RESPONSE.value, response.messageType)
- Assertions.assertEquals(DeliveryStatus.BASAL_ACTIVE, response.deliveryStatus)
- Assertions.assertEquals(PodStatus.RUNNING_ABOVE_MIN_VOLUME, response.podStatus)
- Assertions.assertEquals(8.toShort(), response.sequenceNumberOfLastProgrammingCommand)
- Assertions.assertEquals(14.toShort(), response.bolusPulsesRemaining)
- Assertions.assertEquals(0, response.activeAlerts.size)
- Assertions.assertEquals(3689.toShort(), response.minutesSinceActivation)
- Assertions.assertEquals(1023.toShort(), response.reservoirPulsesRemaining)
- Assertions.assertEquals(2611.toShort(), response.totalPulsesDelivered)
+ assertThat(response.encoded).asList().containsExactlyElementsIn(encoded.asList()).inOrder()
+ assertThat(response.encoded).isNotSameInstanceAs(encoded)
+ assertThat(response.responseType).isEqualTo(ResponseType.DEFAULT_STATUS_RESPONSE)
+ assertThat(response.messageType).isEqualTo(ResponseType.DEFAULT_STATUS_RESPONSE.value)
+ assertThat(response.deliveryStatus).isEqualTo(DeliveryStatus.BASAL_ACTIVE)
+ assertThat(response.podStatus).isEqualTo(PodStatus.RUNNING_ABOVE_MIN_VOLUME)
+ assertThat(response.sequenceNumberOfLastProgrammingCommand).isEqualTo(8.toShort())
+ assertThat(response.bolusPulsesRemaining).isEqualTo(14.toShort())
+ assertThat(response.activeAlerts).isEmpty()
+ assertThat(response.minutesSinceActivation).isEqualTo(3689.toShort())
+ assertThat(response.reservoirPulsesRemaining).isEqualTo(1023.toShort())
+ assertThat(response.totalPulsesDelivered).isEqualTo(2611.toShort())
}
/** response (hex) 1D990714201F0042ED8801DE
@@ -118,21 +118,21 @@ class DefaultStatusResponseTest {
Full reservoir pulses remaining: 392
Time since activation: 4283
*/
- @Test @Throws(DecoderException::class) fun testValidResponseReservoirPulsesRemaining() {
+ @Test fun testValidResponseReservoirPulsesRemaining() {
val encoded = Hex.decodeHex("1D990714201F0042ED8801DE")
val response = DefaultStatusResponse(encoded)
- Assertions.assertArrayEquals(encoded, response.encoded)
- Assertions.assertNotSame(encoded, response.encoded)
- Assertions.assertEquals(ResponseType.DEFAULT_STATUS_RESPONSE, response.responseType)
- Assertions.assertEquals(ResponseType.DEFAULT_STATUS_RESPONSE.value, response.messageType)
- Assertions.assertEquals(DeliveryStatus.UNKNOWN, response.deliveryStatus) // Extended bolus active
- Assertions.assertEquals(PodStatus.RUNNING_BELOW_MIN_VOLUME, response.podStatus)
- Assertions.assertEquals(4.toShort(), response.sequenceNumberOfLastProgrammingCommand)
- Assertions.assertEquals(31.toShort(), response.bolusPulsesRemaining)
- Assertions.assertEquals(0, response.activeAlerts.size)
- Assertions.assertEquals(4283.toShort(), response.minutesSinceActivation)
- Assertions.assertEquals(392.toShort(), response.reservoirPulsesRemaining)
- Assertions.assertEquals(3624.toShort(), response.totalPulsesDelivered)
+ assertThat(response.encoded).asList().containsExactlyElementsIn(encoded.asList()).inOrder()
+ assertThat(response.encoded).isNotSameInstanceAs(encoded)
+ assertThat(response.responseType).isEqualTo(ResponseType.DEFAULT_STATUS_RESPONSE)
+ assertThat(response.messageType).isEqualTo(ResponseType.DEFAULT_STATUS_RESPONSE.value)
+ assertThat(response.deliveryStatus).isEqualTo(DeliveryStatus.UNKNOWN) // Extended bolus active
+ assertThat(response.podStatus).isEqualTo(PodStatus.RUNNING_BELOW_MIN_VOLUME)
+ assertThat(response.sequenceNumberOfLastProgrammingCommand).isEqualTo(4.toShort())
+ assertThat(response.bolusPulsesRemaining).isEqualTo(31.toShort())
+ assertThat(response.activeAlerts).isEmpty()
+ assertThat(response.minutesSinceActivation).isEqualTo(4283.toShort())
+ assertThat(response.reservoirPulsesRemaining).isEqualTo(392.toShort())
+ assertThat(response.totalPulsesDelivered).isEqualTo(3624.toShort())
}
/** response (hex) 1d68002601f400002bff0368
@@ -148,13 +148,13 @@ class DefaultStatusResponseTest {
Full reservoir pulses remaining: 392
Time since activation: 4283
*/
- @Test @Throws(DecoderException::class) fun testValidResponseBolusPulsesRemaining3() {
+ @Test fun testValidResponseBolusPulsesRemaining3() {
val encoded = Hex.decodeHex("1d68002601f400002bff0368")
val response = DefaultStatusResponse(encoded)
- Assertions.assertArrayEquals(encoded, response.encoded)
- Assertions.assertNotSame(encoded, response.encoded)
- Assertions.assertEquals(500.toShort(), response.bolusPulsesRemaining)
- Assertions.assertEquals(0, response.activeAlerts.size)
+ assertThat(response.encoded).asList().containsExactlyElementsIn(encoded.asList()).inOrder()
+ assertThat(response.encoded).isNotSameInstanceAs(encoded)
+ assertThat(response.bolusPulsesRemaining).isEqualTo(500.toShort())
+ assertThat(response.activeAlerts).isEmpty()
}
/** response (hex) 1d28002e91e400002fff8256
@@ -170,13 +170,13 @@ class DefaultStatusResponseTest {
Full reservoir pulses remaining: 392
Time since activation: 4283
*/
- @Test @Throws(DecoderException::class) fun testValidResponseBolusPulsesRemaining4() {
+ @Test fun testValidResponseBolusPulsesRemaining4() {
val encoded = Hex.decodeHex("1d28002e91e400002fff8256")
val response = DefaultStatusResponse(encoded)
- Assertions.assertArrayEquals(encoded, response.encoded)
- Assertions.assertNotSame(encoded, response.encoded)
- Assertions.assertEquals(484.toShort(), response.bolusPulsesRemaining)
- Assertions.assertEquals(0, response.activeAlerts.size)
+ assertThat(response.encoded).asList().containsExactlyElementsIn(encoded.asList()).inOrder()
+ assertThat(response.encoded).isNotSameInstanceAs(encoded)
+ assertThat(response.bolusPulsesRemaining).isEqualTo(484.toShort())
+ assertThat(response.activeAlerts).isEmpty()
}
/*
@@ -200,21 +200,21 @@ class DefaultStatusResponseTest {
Alert 7 is Active
Occlusion alert active false
*/
- @Test @Throws(DecoderException::class) fun testValidResponseActiveAlert1() {
+ @Test fun testValidResponseActiveAlert1() {
val encoded = Hex.decodeHex("1D980559C820404393FF83AA")
val response = DefaultStatusResponse(encoded)
- Assertions.assertArrayEquals(encoded, response.encoded)
- Assertions.assertNotSame(encoded, response.encoded)
- Assertions.assertEquals(ResponseType.DEFAULT_STATUS_RESPONSE, response.responseType)
- Assertions.assertEquals(ResponseType.DEFAULT_STATUS_RESPONSE.value, response.messageType)
- Assertions.assertEquals(DeliveryStatus.UNKNOWN, response.deliveryStatus)
- Assertions.assertEquals(PodStatus.RUNNING_ABOVE_MIN_VOLUME, response.podStatus)
- Assertions.assertEquals(9.toShort(), response.sequenceNumberOfLastProgrammingCommand)
- Assertions.assertEquals(32.toShort(), response.bolusPulsesRemaining)
- Assertions.assertEquals(1, response.activeAlerts.size)
- Assertions.assertEquals(4324.toShort(), response.minutesSinceActivation)
- Assertions.assertEquals(1023.toShort(), response.reservoirPulsesRemaining)
- Assertions.assertEquals(2739.toShort(), response.totalPulsesDelivered)
- Assertions.assertEquals(true, response.activeAlerts.contains(AlertType.EXPIRATION))
+ assertThat(response.encoded).asList().containsExactlyElementsIn(encoded.asList()).inOrder()
+ assertThat(response.encoded).isNotSameInstanceAs(encoded)
+ assertThat(response.responseType).isEqualTo(ResponseType.DEFAULT_STATUS_RESPONSE)
+ assertThat(response.messageType).isEqualTo(ResponseType.DEFAULT_STATUS_RESPONSE.value)
+ assertThat(response.deliveryStatus).isEqualTo(DeliveryStatus.UNKNOWN)
+ assertThat(response.podStatus).isEqualTo(PodStatus.RUNNING_ABOVE_MIN_VOLUME)
+ assertThat(response.sequenceNumberOfLastProgrammingCommand).isEqualTo(9.toShort())
+ assertThat(response.bolusPulsesRemaining).isEqualTo(32.toShort())
+ assertThat(response.activeAlerts).hasSize(1)
+ assertThat(response.minutesSinceActivation).isEqualTo(4324.toShort())
+ assertThat(response.reservoirPulsesRemaining).isEqualTo(1023.toShort())
+ assertThat(response.totalPulsesDelivered).isEqualTo(2739.toShort())
+ assertThat(response.activeAlerts.contains(AlertType.EXPIRATION)).isTrue()
}
}
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/NakResponseTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/NakResponseTest.kt
index 86e2d7e28e..53c19b63fa 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/NakResponseTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/NakResponseTest.kt
@@ -1,26 +1,26 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response
+import com.google.common.truth.Truth.assertThat
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlarmType
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.NakErrorType
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodStatus
import org.apache.commons.codec.DecoderException
import org.apache.commons.codec.binary.Hex
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
class NakResponseTest {
- @Test @Throws(DecoderException::class) fun testValidResponse() {
+ @Test fun testValidResponse() {
val encoded = Hex.decodeHex("0603070009")
val response = NakResponse(encoded)
- Assertions.assertArrayEquals(encoded, response.encoded)
- Assertions.assertNotSame(encoded, response.encoded)
- Assertions.assertEquals(ResponseType.NAK_RESPONSE, response.responseType)
- Assertions.assertEquals(ResponseType.NAK_RESPONSE.value, response.messageType)
- Assertions.assertEquals(NakErrorType.ILLEGAL_PARAM, response.nakErrorType)
- Assertions.assertEquals(AlarmType.NONE, response.alarmType)
- Assertions.assertEquals(PodStatus.RUNNING_BELOW_MIN_VOLUME, response.podStatus)
- Assertions.assertEquals(0x00.toShort(), response.securityNakSyncCount)
+ assertThat(response.encoded).asList().containsExactlyElementsIn(encoded.asList()).inOrder()
+ assertThat(response.encoded).isNotSameInstanceAs(encoded)
+ assertThat(response.responseType).isEqualTo(ResponseType.NAK_RESPONSE)
+ assertThat(response.messageType).isEqualTo(ResponseType.NAK_RESPONSE.value)
+ assertThat(response.nakErrorType).isEqualTo(NakErrorType.ILLEGAL_PARAM)
+ assertThat(response.alarmType).isEqualTo(AlarmType.NONE)
+ assertThat(response.podStatus).isEqualTo(PodStatus.RUNNING_BELOW_MIN_VOLUME)
+ assertThat(response.securityNakSyncCount).isEqualTo(0x00.toShort())
}
}
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/SetUniqueIdResponseTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/SetUniqueIdResponseTest.kt
index 10460252df..99015de4f7 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/SetUniqueIdResponseTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/SetUniqueIdResponseTest.kt
@@ -1,39 +1,39 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response
+import com.google.common.truth.Truth.assertThat
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodStatus
import org.apache.commons.codec.DecoderException
import org.apache.commons.codec.binary.Hex
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
class SetUniqueIdResponseTest {
- @Test @Throws(DecoderException::class) fun testValidResponse() {
+ @Test fun testValidResponse() {
val encoded = Hex.decodeHex("011B13881008340A50040A00010300040308146CC1000954D402420001")
val response = SetUniqueIdResponse(encoded)
- Assertions.assertArrayEquals(encoded, response.encoded)
- Assertions.assertNotSame(encoded, response.encoded)
- Assertions.assertEquals(ResponseType.ACTIVATION_RESPONSE, response.responseType)
- Assertions.assertEquals(ResponseType.ActivationResponseType.SET_UNIQUE_ID_RESPONSE, response.activationResponseType)
- Assertions.assertEquals(ResponseType.ACTIVATION_RESPONSE.value, response.messageType)
- Assertions.assertEquals(27.toShort(), response.messageLength)
- Assertions.assertEquals(5000.toShort(), response.pulseVolumeInTenThousandthMicroLiter)
- Assertions.assertEquals(16.toShort(), response.pumpRate)
- Assertions.assertEquals(8.toShort(), response.primePumpRate)
- Assertions.assertEquals(52.toShort(), response.numberOfEngagingClutchDrivePulses)
- Assertions.assertEquals(10.toShort(), response.numberOfPrimePulses)
- Assertions.assertEquals(80.toShort(), response.podExpirationTimeInHours)
- Assertions.assertEquals(4.toShort(), response.firmwareVersionMajor)
- Assertions.assertEquals(10.toShort(), response.firmwareVersionMinor)
- Assertions.assertEquals(0.toShort(), response.firmwareVersionInterim)
- Assertions.assertEquals(1.toShort(), response.bleVersionMajor)
- Assertions.assertEquals(3.toShort(), response.bleVersionMinor)
- Assertions.assertEquals(0.toShort(), response.bleVersionInterim)
- Assertions.assertEquals(4.toShort(), response.productId)
- Assertions.assertEquals(PodStatus.UID_SET, response.podStatus)
- Assertions.assertEquals(135556289L, response.lotNumber)
- Assertions.assertEquals(611540L, response.podSequenceNumber)
- Assertions.assertEquals(37879809L, response.uniqueIdReceivedInCommand)
+ assertThat(response.encoded).asList().containsExactlyElementsIn(encoded.asList()).inOrder()
+ assertThat(response.encoded).isNotSameInstanceAs(encoded)
+ assertThat(response.responseType).isEqualTo(ResponseType.ACTIVATION_RESPONSE)
+ assertThat(response.activationResponseType).isEqualTo(ResponseType.ActivationResponseType.SET_UNIQUE_ID_RESPONSE)
+ assertThat(response.messageType).isEqualTo(ResponseType.ACTIVATION_RESPONSE.value)
+ assertThat(response.messageLength).isEqualTo(27.toShort())
+ assertThat(response.pulseVolumeInTenThousandthMicroLiter).isEqualTo(5000.toShort())
+ assertThat(response.pumpRate).isEqualTo(16.toShort())
+ assertThat(response.primePumpRate).isEqualTo(8.toShort())
+ assertThat(response.numberOfEngagingClutchDrivePulses).isEqualTo(52.toShort())
+ assertThat(response.numberOfPrimePulses).isEqualTo(10.toShort())
+ assertThat(response.podExpirationTimeInHours).isEqualTo(80.toShort())
+ assertThat(response.firmwareVersionMajor).isEqualTo(4.toShort())
+ assertThat(response.firmwareVersionMinor).isEqualTo(10.toShort())
+ assertThat(response.firmwareVersionInterim).isEqualTo(0.toShort())
+ assertThat(response.bleVersionMajor).isEqualTo(1.toShort())
+ assertThat(response.bleVersionMinor).isEqualTo(3.toShort())
+ assertThat(response.bleVersionInterim).isEqualTo(0.toShort())
+ assertThat(response.productId).isEqualTo(4.toShort())
+ assertThat(response.podStatus).isEqualTo(PodStatus.UID_SET)
+ assertThat(response.lotNumber).isEqualTo(135556289L)
+ assertThat(response.podSequenceNumber).isEqualTo(611540L)
+ assertThat(response.uniqueIdReceivedInCommand).isEqualTo(37879809L)
}
}
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/VersionResponseTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/VersionResponseTest.kt
index 7cc313a5bc..aa79c8afd9 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/VersionResponseTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/VersionResponseTest.kt
@@ -1,35 +1,35 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response
+import com.google.common.truth.Truth.assertThat
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodStatus
import org.apache.commons.codec.DecoderException
import org.apache.commons.codec.binary.Hex
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
class VersionResponseTest {
- @Test @Throws(DecoderException::class) fun testValidResponse() {
+ @Test fun testValidResponse() {
val encoded = Hex.decodeHex("0115040A00010300040208146CC1000954D400FFFFFFFF")
val response = VersionResponse(encoded)
- Assertions.assertArrayEquals(encoded, response.encoded)
- Assertions.assertNotSame(encoded, response.encoded)
- Assertions.assertEquals(ResponseType.ACTIVATION_RESPONSE, response.responseType)
- Assertions.assertEquals(ResponseType.ActivationResponseType.GET_VERSION_RESPONSE, response.activationResponseType)
- Assertions.assertEquals(ResponseType.ACTIVATION_RESPONSE.value, response.messageType)
- Assertions.assertEquals(21.toShort(), response.messageLength)
- Assertions.assertEquals(4.toShort(), response.firmwareVersionMajor)
- Assertions.assertEquals(10.toShort(), response.firmwareVersionMinor)
- Assertions.assertEquals(0.toShort(), response.firmwareVersionInterim)
- Assertions.assertEquals(1.toShort(), response.bleVersionMajor)
- Assertions.assertEquals(3.toShort(), response.bleVersionMinor)
- Assertions.assertEquals(0.toShort(), response.bleVersionInterim)
- Assertions.assertEquals(4.toShort(), response.productId)
- Assertions.assertEquals(PodStatus.FILLED, response.podStatus)
- Assertions.assertEquals(135556289L, response.lotNumber)
- Assertions.assertEquals(611540L, response.podSequenceNumber)
- Assertions.assertEquals(0.toByte(), response.rssi)
- Assertions.assertEquals(0.toByte(), response.receiverLowerGain)
- Assertions.assertEquals(4294967295L, response.uniqueIdReceivedInCommand)
+ assertThat(response.encoded).asList().containsExactlyElementsIn(encoded.asList()).inOrder()
+ assertThat(response.encoded).isNotSameInstanceAs(encoded)
+ assertThat(response.responseType).isEqualTo(ResponseType.ACTIVATION_RESPONSE)
+ assertThat(response.activationResponseType).isEqualTo(ResponseType.ActivationResponseType.GET_VERSION_RESPONSE)
+ assertThat(response.messageType).isEqualTo(ResponseType.ACTIVATION_RESPONSE.value)
+ assertThat(response.messageLength).isEqualTo(21.toShort())
+ assertThat(response.firmwareVersionMajor).isEqualTo(4.toShort())
+ assertThat(response.firmwareVersionMinor).isEqualTo(10.toShort())
+ assertThat(response.firmwareVersionInterim).isEqualTo(0.toShort())
+ assertThat(response.bleVersionMajor).isEqualTo(1.toShort())
+ assertThat(response.bleVersionMinor).isEqualTo(3.toShort())
+ assertThat(response.bleVersionInterim).isEqualTo(0.toShort())
+ assertThat(response.productId).isEqualTo(4.toShort())
+ assertThat(response.podStatus).isEqualTo(PodStatus.FILLED)
+ assertThat(response.lotNumber).isEqualTo(135556289L)
+ assertThat(response.podSequenceNumber).isEqualTo(611540L)
+ assertThat(response.rssi).isEqualTo(0.toByte())
+ assertThat(response.receiverLowerGain).isEqualTo(0.toByte())
+ assertThat(response.uniqueIdReceivedInCommand).isEqualTo(4294967295L)
}
}
diff --git a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/util/FunctionsTest.kt b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/util/FunctionsTest.kt
index 52ebcf240b..f6bb6ceb46 100644
--- a/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/util/FunctionsTest.kt
+++ b/pump/omnipod-dash/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/util/FunctionsTest.kt
@@ -1,10 +1,10 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.util
import app.aaps.core.interfaces.profile.Profile
+import com.google.common.truth.Truth.assertThat
import app.aaps.core.interfaces.profile.Profile.ProfileValue
import com.google.common.truth.Truth.assertThat
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.BasalProgram
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import org.mockito.Mockito
import org.mockito.Mockito.`when`
@@ -25,19 +25,19 @@ class FunctionsTest {
val basalProgram: BasalProgram = mapProfileToBasalProgram(profile)
val entries: List = basalProgram.segments
- Assertions.assertEquals(3, entries.size)
+ assertThat(entries).hasSize(3)
val entry1: BasalProgram.Segment = entries[0]
- Assertions.assertEquals(0.toShort(), entry1.startSlotIndex)
- Assertions.assertEquals(50, entry1.basalRateInHundredthUnitsPerHour)
- Assertions.assertEquals(10.toShort(), entry1.endSlotIndex)
+ assertThat(entry1.startSlotIndex).isEqualTo(0.toShort())
+ assertThat(entry1.basalRateInHundredthUnitsPerHour).isEqualTo(50)
+ assertThat(entry1.endSlotIndex).isEqualTo(10.toShort())
val entry2: BasalProgram.Segment = entries[1]
- Assertions.assertEquals(10.toShort(), entry2.startSlotIndex)
- Assertions.assertEquals(100, entry2.basalRateInHundredthUnitsPerHour)
- Assertions.assertEquals(28.toShort(), entry2.endSlotIndex)
+ assertThat(entry2.startSlotIndex).isEqualTo(10.toShort())
+ assertThat(entry2.basalRateInHundredthUnitsPerHour).isEqualTo(100)
+ assertThat(entry2.endSlotIndex).isEqualTo(28.toShort())
val entry3: BasalProgram.Segment = entries[2]
- Assertions.assertEquals(28.toShort(), entry3.startSlotIndex)
- Assertions.assertEquals(305, entry3.basalRateInHundredthUnitsPerHour)
- Assertions.assertEquals(48.toShort(), entry3.endSlotIndex)
+ assertThat(entry3.startSlotIndex).isEqualTo(28.toShort())
+ assertThat(entry3.basalRateInHundredthUnitsPerHour).isEqualTo(305)
+ assertThat(entry3.endSlotIndex).isEqualTo(48.toShort())
}
@Test fun invalidProfileZeroEntries() {
@@ -104,6 +104,6 @@ class FunctionsTest {
val basalProgram: BasalProgram = mapProfileToBasalProgram(profile)
val basalProgramElement: BasalProgram.Segment = basalProgram.segments[0]
- Assertions.assertEquals(5, basalProgramElement.basalRateInHundredthUnitsPerHour)
+ assertThat(basalProgramElement.basalRateInHundredthUnitsPerHour).isEqualTo(5)
}
}
diff --git a/pump/omnipod-eros/src/main/res/values-no-rNO/strings.xml b/pump/omnipod-eros/src/main/res/values-nb-rNO/strings.xml
similarity index 100%
rename from pump/omnipod-eros/src/main/res/values-no-rNO/strings.xml
rename to pump/omnipod-eros/src/main/res/values-nb-rNO/strings.xml
diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.kt b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.kt
index a9f079cc50..e006ffd4d4 100644
--- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.kt
+++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/OmnipodErosPumpPluginTest.kt
@@ -11,6 +11,7 @@ import app.aaps.core.interfaces.utils.DecimalFormatter
import app.aaps.implementation.utils.DecimalFormatterImpl
import app.aaps.shared.tests.TestBase
import app.aaps.shared.tests.rx.TestAapsSchedulers
+import com.google.common.truth.Truth.assertThat
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil
@@ -19,7 +20,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodE
import info.nightscout.pump.common.defs.TempBasalPair
import org.joda.time.DateTimeZone
import org.joda.time.tz.UTCProvider
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.ArgumentMatchers
@@ -100,17 +100,17 @@ class OmnipodErosPumpPluginTest : TestBase() {
val result5 =
plugin.setTempBasalPercent(-50, 60, profile, false, PumpSync.TemporaryBasalType.NORMAL)
// Then return correct values
- Assertions.assertEquals(result1.absolute, 0.4, 0.01)
- Assertions.assertEquals(result1.duration, 30)
- Assertions.assertEquals(result2.absolute, 25.0, 0.01)
- Assertions.assertEquals(result2.duration, 30000)
- Assertions.assertEquals(result3.absolute, 0.0, 0.01)
- Assertions.assertEquals(result3.duration, 30)
- Assertions.assertEquals(result4.absolute, -1.0, 0.01)
- Assertions.assertEquals(result4.duration, -1)
+ assertThat(result1.absolute).isWithin(0.01).of(0.4)
+ assertThat(result1.duration).isEqualTo(30)
+ assertThat(result2.absolute).isWithin(0.01).of(25.0)
+ assertThat(result2.duration).isEqualTo(30000)
+ assertThat(result3.absolute).isWithin(0.01).of(0.0)
+ assertThat(result3.duration).isEqualTo(30)
+ assertThat(result4.absolute).isWithin(0.01).of(-1.0)
+ assertThat(result4.duration).isEqualTo(-1)
// this is validated downstream, see TempBasalExtraCommand
- Assertions.assertEquals(result5.absolute, -0.25, 0.01)
- Assertions.assertEquals(result5.duration, 60)
+ assertThat(result5.absolute).isWithin(0.01).of(-0.25)
+ assertThat(result5.duration).isEqualTo(60)
// Given zero basal
`when`(profile.getBasal()).thenReturn(0.0)
@@ -120,10 +120,10 @@ class OmnipodErosPumpPluginTest : TestBase() {
result2 =
plugin.setTempBasalPercent(0, 0, profile, false, PumpSync.TemporaryBasalType.NORMAL)
// Then return zero values
- Assertions.assertEquals(result1.absolute, 0.0, 0.01)
- Assertions.assertEquals(result1.duration, 90)
- Assertions.assertEquals(result2.absolute, -1.0, 0.01)
- Assertions.assertEquals(result2.duration, -1)
+ assertThat(result1.absolute).isWithin(0.01).of(0.0)
+ assertThat(result1.duration).isEqualTo(90)
+ assertThat(result2.absolute).isWithin(0.01).of(-1.0)
+ assertThat(result2.duration).isEqualTo(-1)
// Given unhealthy basal
`when`(profile.getBasal()).thenReturn(500.0)
@@ -131,12 +131,10 @@ class OmnipodErosPumpPluginTest : TestBase() {
result1 =
plugin.setTempBasalPercent(80, 30, profile, false, PumpSync.TemporaryBasalType.NORMAL)
// Then return sane values
- Assertions.assertEquals(
- result1.absolute,
- PumpType.OMNIPOD_EROS.determineCorrectBasalSize(500.0 * 0.8),
- 0.01
+ assertThat(result1.absolute).isWithin(0.01).of(
+ PumpType.OMNIPOD_EROS.determineCorrectBasalSize(500.0 * 0.8)
)
- Assertions.assertEquals(result1.duration, 30)
+ assertThat(result1.duration).isEqualTo(30)
// Given weird basal
`when`(profile.getBasal()).thenReturn(1.234567)
@@ -144,8 +142,8 @@ class OmnipodErosPumpPluginTest : TestBase() {
result1 =
plugin.setTempBasalPercent(280, 600, profile, false, PumpSync.TemporaryBasalType.NORMAL)
// Then return sane values
- Assertions.assertEquals(result1.absolute, 3.4567876, 0.01)
- Assertions.assertEquals(result1.duration, 600)
+ assertThat(result1.absolute).isWithin(0.01).of(3.4567876)
+ assertThat(result1.duration).isEqualTo(600)
// Given negative basal
`when`(profile.getBasal()).thenReturn(-1.234567)
@@ -153,7 +151,7 @@ class OmnipodErosPumpPluginTest : TestBase() {
result1 =
plugin.setTempBasalPercent(280, 510, profile, false, PumpSync.TemporaryBasalType.NORMAL)
// Then return negative value (this is validated further downstream, see TempBasalExtraCommand)
- Assertions.assertEquals(result1.absolute, -3.4567876, 0.01)
- Assertions.assertEquals(result1.duration, 510)
+ assertThat(result1.absolute).isWithin(0.01).of(-3.4567876)
+ assertThat(result1.duration).isEqualTo(510)
}
-}
\ No newline at end of file
+}
diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/AapsOmnipodErosManagerTest.kt b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/AapsOmnipodErosManagerTest.kt
index 319949317b..5cd712ad0f 100644
--- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/AapsOmnipodErosManagerTest.kt
+++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/AapsOmnipodErosManagerTest.kt
@@ -2,9 +2,9 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communicatio
import app.aaps.core.interfaces.profile.Profile
import app.aaps.core.interfaces.profile.Profile.ProfileValue
+import com.google.common.truth.Truth.assertThat
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager
import org.joda.time.Duration
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import org.mockito.Mockito
import kotlin.test.assertFailsWith
@@ -22,16 +22,16 @@ internal class AapsOmnipodErosManagerTest {
)
val basalSchedule = AapsOmnipodErosManager.mapProfileToBasalSchedule(profile)
val entries = basalSchedule.entries
- Assertions.assertEquals(3, entries.size)
+ assertThat(entries).hasSize(3)
val entry1 = entries[0]
- Assertions.assertEquals(Duration.standardSeconds(0), entry1.startTime)
- Assertions.assertEquals(0.5, entry1.rate, 0.000001)
+ assertThat(entry1.startTime).isEqualTo(Duration.standardSeconds(0))
+ assertThat(entry1.rate).isWithin(0.000001).of(0.5)
val entry2 = entries[1]
- Assertions.assertEquals(Duration.standardSeconds(18000), entry2.startTime)
- Assertions.assertEquals(1.0, entry2.rate, 0.000001)
+ assertThat(entry2.startTime).isEqualTo(Duration.standardSeconds(18000))
+ assertThat(entry2.rate).isWithin(0.000001).of(1.0)
val entry3 = entries[2]
- Assertions.assertEquals(Duration.standardSeconds(50400), entry3.startTime)
- Assertions.assertEquals(3.05, entry3.rate, 0.000001)
+ assertThat(entry3.startTime).isEqualTo(Duration.standardSeconds(50400))
+ assertThat(entry3.rate).isWithin(0.000001).of(3.05)
}
@Test fun invalidProfileNullProfile() {
@@ -90,6 +90,6 @@ internal class AapsOmnipodErosManagerTest {
)
val basalSchedule = AapsOmnipodErosManager.mapProfileToBasalSchedule(profile)
val basalScheduleEntry = basalSchedule.entries[0]
- Assertions.assertEquals(0.05, basalScheduleEntry.rate, 0.000001)
+ assertThat(basalScheduleEntry.rate).isWithin(0.000001).of(0.05)
}
}
diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoResponseTest.kt b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoResponseTest.kt
index bf97fff625..f989ffe4d8 100644
--- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoResponseTest.kt
+++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/driver/communication/message/response/podinfo/PodInfoResponseTest.kt
@@ -3,35 +3,35 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communicatio
import com.google.common.truth.Truth.assertThat
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.PodInfoType
import info.nightscout.pump.common.utils.ByteUtil
-import org.junit.jupiter.api.Assertions
+import kotlin.test.assertIsNot
import org.junit.jupiter.api.Test
internal class PodInfoResponseTest {
@Test fun testRawData() {
- val encodedData = ByteUtil.fromHexString("0216020d0000000000ab6a038403ff03860000285708030d")
+ val encodedData = ByteUtil.fromHexString("0216020d0000000000ab6a038403ff03860000285708030d")!!
val podInfoResponse = PodInfoResponse(encodedData)
- Assertions.assertArrayEquals(encodedData, podInfoResponse.rawData)
+ assertThat(podInfoResponse.rawData.asList()).containsExactlyElementsIn(encodedData.asIterable()).inOrder()
}
@Test fun testRawDataWithLongerMessage() {
- val encodedData = ByteUtil.fromHexString("0216020d0000000000ab6a038403ff03860000285708030d01")
- val expected = ByteUtil.fromHexString("0216020d0000000000ab6a038403ff03860000285708030d")
+ val encodedData = ByteUtil.fromHexString("0216020d0000000000ab6a038403ff03860000285708030d01")!!
+ val expected = ByteUtil.fromHexString("0216020d0000000000ab6a038403ff03860000285708030d")!!
val podInfoResponse = PodInfoResponse(encodedData)
- Assertions.assertArrayEquals(expected, podInfoResponse.rawData)
+ assertThat(podInfoResponse.rawData.asList()).containsExactlyElementsIn(expected.asIterable()).inOrder()
}
@Test fun testMessageDecoding() {
val podInfoResponse = PodInfoResponse(ByteUtil.fromHexString("0216020d0000000000ab6a038403ff03860000285708030d"))
- Assertions.assertEquals(PodInfoType.DETAILED_STATUS, podInfoResponse.subType)
+ assertThat(podInfoResponse.subType).isEqualTo(PodInfoType.DETAILED_STATUS)
val podInfo = podInfoResponse.podInfo as PodInfoDetailedStatus
- Assertions.assertFalse(podInfo.isFaultAccessingTables)
- Assertions.assertEquals(0x01, podInfo.errorEventInfo.internalVariable.toInt())
+ assertThat(podInfo.isFaultAccessingTables).isFalse()
+ assertThat(podInfo.errorEventInfo.internalVariable.toInt()).isEqualTo(0x01)
}
@Test fun testInvalidPodInfoTypeMessageDecoding() {
val podInfoResponse = PodInfoResponse(ByteUtil.fromHexString("0216020d0000000000ab6a038403ff03860000285708030d"))
- Assertions.assertEquals(PodInfoType.DETAILED_STATUS, podInfoResponse.subType)
- assertThat(podInfoResponse.podInfo).isNotInstanceOf(PodInfoActiveAlerts::class.java)
+ assertThat(podInfoResponse.subType).isEqualTo(PodInfoType.DETAILED_STATUS)
+ assertIsNot(podInfoResponse.podInfo)
}
}
diff --git a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsErosPodStateManagerTest.kt b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsErosPodStateManagerTest.kt
index 8880aa2ae6..a4a03a759e 100644
--- a/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsErosPodStateManagerTest.kt
+++ b/pump/omnipod-eros/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/manager/AapsErosPodStateManagerTest.kt
@@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.manager
import app.aaps.core.interfaces.sharedPreferences.SP
import app.aaps.shared.tests.TestBase
+import com.google.common.truth.Truth.assertThat
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.FirmwareVersion
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.PodProgressStatus
import org.joda.time.DateTime
@@ -9,7 +10,6 @@ import org.joda.time.DateTimeUtils
import org.joda.time.DateTimeZone
import org.joda.time.Duration
import org.junit.jupiter.api.AfterEach
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import org.mockito.Mock
@@ -28,11 +28,10 @@ class AapsErosPodStateManagerTest : TestBase() {
0, 0, FirmwareVersion(1, 1, 1),
FirmwareVersion(2, 2, 2), timeZone, PodProgressStatus.ABOVE_FIFTY_UNITS
)
- Assertions.assertEquals(now, podStateManager.time)
- Assertions.assertEquals(
+ assertThat(podStateManager.time).isEqualTo(now)
+ assertThat(podStateManager.scheduleOffset).isEqualTo(
Duration.standardHours(1)
- .plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))),
- podStateManager.scheduleOffset
+ .plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3)))
)
}
@@ -52,11 +51,10 @@ class AapsErosPodStateManagerTest : TestBase() {
// The system time zone has been updated, but the pod session state's time zone hasn't
// So the pods time should not have been changed
- Assertions.assertEquals(now, podStateManager.time)
- Assertions.assertEquals(
+ assertThat(podStateManager.time).isEqualTo(now)
+ assertThat(podStateManager.scheduleOffset).isEqualTo(
Duration.standardHours(1)
- .plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))),
- podStateManager.scheduleOffset
+ .plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3)))
)
}
@@ -77,15 +75,14 @@ class AapsErosPodStateManagerTest : TestBase() {
// Both the system time zone have been updated
// So the pods time should have been changed (to +2 hours)
- Assertions.assertEquals(now.withZone(newTimeZone), podStateManager.time)
- Assertions.assertEquals(
+ assertThat(podStateManager.time).isEqualTo(now.withZone(newTimeZone))
+ assertThat(podStateManager.scheduleOffset).isEqualTo(
Duration.standardHours(3)
- .plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))),
- podStateManager.scheduleOffset
+ .plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3)))
)
}
@AfterEach fun tearDown() {
DateTimeUtils.setCurrentMillisSystem()
}
-}
\ No newline at end of file
+}
diff --git a/pump/pump-common/src/main/java/info/nightscout/pump/common/defs/PumpHistoryEntryGroup.kt b/pump/pump-common/src/main/java/info/nightscout/pump/common/defs/PumpHistoryEntryGroup.kt
index c03747dda1..83b4130f6c 100644
--- a/pump/pump-common/src/main/java/info/nightscout/pump/common/defs/PumpHistoryEntryGroup.kt
+++ b/pump/pump-common/src/main/java/info/nightscout/pump/common/defs/PumpHistoryEntryGroup.kt
@@ -2,7 +2,6 @@ package info.nightscout.pump.common.defs
import app.aaps.core.interfaces.resources.ResourceHelper
import info.nightscout.pump.common.R
-import kotlin.streams.toList
/**
* This file was taken from GGC - GNU Gluco Control (ggc.sourceforge.net), application for diabetes
@@ -63,17 +62,12 @@ enum class PumpHistoryEntryGroup(val resourceId: Int, val pumpTypeGroupConfig: P
val outList: List
if (pumpTypeGroupConfig == PumpTypeGroupConfig.All) {
- outList = translatedList!!.stream()
- .filter { pre -> pre.pumpTypeGroupConfig == PumpTypeGroupConfig.All }
- .toList()
+ outList = translatedList!!.filter { pre -> pre.pumpTypeGroupConfig == PumpTypeGroupConfig.All }
} else {
- outList = translatedList!!.stream()
- .filter { pre -> (pre.pumpTypeGroupConfig == PumpTypeGroupConfig.All || pre.pumpTypeGroupConfig == pumpTypeGroupConfig) }
- .toList()
+ outList = translatedList!!.filter { pre -> (pre.pumpTypeGroupConfig == PumpTypeGroupConfig.All || pre.pumpTypeGroupConfig == pumpTypeGroupConfig) }
}
return outList
}
}
-
}
\ No newline at end of file
diff --git a/pump/pump-common/src/main/res/values-no-rNO/strings.xml b/pump/pump-common/src/main/res/values-nb-rNO/strings.xml
similarity index 100%
rename from pump/pump-common/src/main/res/values-no-rNO/strings.xml
rename to pump/pump-common/src/main/res/values-nb-rNO/strings.xml
diff --git a/pump/rileylink/src/main/res/values-no-rNO/strings.xml b/pump/rileylink/src/main/res/values-nb-rNO/strings.xml
similarity index 97%
rename from pump/rileylink/src/main/res/values-no-rNO/strings.xml
rename to pump/rileylink/src/main/res/values-nb-rNO/strings.xml
index c2a43ee706..eba97aad46 100644
--- a/pump/rileylink/src/main/res/values-no-rNO/strings.xml
+++ b/pump/rileylink/src/main/res/values-nb-rNO/strings.xml
@@ -27,7 +27,7 @@
Batterinivå:
%1$d%%
Tilkoblingsstatus:
- Tilkoblings feil:
+ Tilkoblingsfeil:
Enhet
Enhets type:
Konfigurert enhetsmodell:
@@ -42,7 +42,7 @@
%1$.2f MHz
Bluetooth initialiserer…
- Bluetooth feil
+ Bluetoothfeil
Bluetooth klar
Ikke startet
RileyLink initialisering…
diff --git a/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyTest.kt b/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyTest.kt
index 85ecd40eda..428e10281c 100644
--- a/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyTest.kt
+++ b/pump/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RFSpyTest.kt
@@ -1,100 +1,34 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble
import app.aaps.shared.tests.TestBase
+import com.google.common.truth.Truth.assertThat
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkFirmwareVersion
-import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
@Suppress("SpellCheckingInspection") class RFSpyTest : TestBase() {
@Test fun testGetFirmwareVersion() {
- Assertions.assertEquals(
- RileyLinkFirmwareVersion.Version_1_0,
- RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.0")
- )
- Assertions.assertEquals(
- RileyLinkFirmwareVersion.Version_1_x,
- RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.1")
- )
- Assertions.assertEquals(
- RileyLinkFirmwareVersion.Version_1_x,
- RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.1.13")
- )
- Assertions.assertEquals(
- RileyLinkFirmwareVersion.Version_2_0,
- RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.0")
- )
- Assertions.assertEquals(
- RileyLinkFirmwareVersion.Version_2_0,
- RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.0.1")
- )
- Assertions.assertEquals(
- RileyLinkFirmwareVersion.Version_2_2,
- RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2")
- )
- Assertions.assertEquals(
- RileyLinkFirmwareVersion.Version_2_2,
- RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2.16")
- )
- Assertions.assertEquals(
- RileyLinkFirmwareVersion.Version_2_2,
- RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2.17")
- )
- Assertions.assertEquals(
- RileyLinkFirmwareVersion.Version_2_x,
- RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3")
- )
- Assertions.assertEquals(
- RileyLinkFirmwareVersion.Version_2_x,
- RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3.0")
- )
- Assertions.assertEquals(
- RileyLinkFirmwareVersion.Version_2_x,
- RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3.17")
- )
- Assertions.assertEquals(
- RileyLinkFirmwareVersion.Version_3_x,
- RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.0")
- )
- Assertions.assertEquals(
- RileyLinkFirmwareVersion.Version_3_x,
- RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.0.1")
- )
- Assertions.assertEquals(
- RileyLinkFirmwareVersion.Version_3_x,
- RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.1")
- )
- Assertions.assertEquals(
- RileyLinkFirmwareVersion.Version_3_x,
- RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.1.13")
- )
- Assertions.assertEquals(
- RileyLinkFirmwareVersion.Version_4_x,
- RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.0")
- )
- Assertions.assertEquals(
- RileyLinkFirmwareVersion.Version_4_x,
- RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.0.4")
- )
- Assertions.assertEquals(
- RileyLinkFirmwareVersion.Version_4_x,
- RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.3")
- )
- Assertions.assertEquals(
- RileyLinkFirmwareVersion.Version_4_x,
- RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.5.7")
- )
- Assertions.assertEquals(
- RileyLinkFirmwareVersion.UnknownVersion,
- RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.0")
- )
- Assertions.assertEquals(
- RileyLinkFirmwareVersion.UnknownVersion,
- RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.0.0")
- )
- Assertions.assertEquals(
- RileyLinkFirmwareVersion.UnknownVersion,
- RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.5.5")
- )
+ assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.0")).isEqualTo(RileyLinkFirmwareVersion.Version_1_0)
+ assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.1")).isEqualTo(RileyLinkFirmwareVersion.Version_1_x)
+ assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.1.13")).isEqualTo(RileyLinkFirmwareVersion.Version_1_x)
+ assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.0")).isEqualTo(RileyLinkFirmwareVersion.Version_2_0)
+ assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.0.1")).isEqualTo(RileyLinkFirmwareVersion.Version_2_0)
+ assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2")).isEqualTo(RileyLinkFirmwareVersion.Version_2_2)
+ assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2.16")).isEqualTo(RileyLinkFirmwareVersion.Version_2_2)
+ assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2.17")).isEqualTo(RileyLinkFirmwareVersion.Version_2_2)
+ assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3")).isEqualTo(RileyLinkFirmwareVersion.Version_2_x)
+ assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3.0")).isEqualTo(RileyLinkFirmwareVersion.Version_2_x)
+ assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3.17")).isEqualTo(RileyLinkFirmwareVersion.Version_2_x)
+ assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.0")).isEqualTo(RileyLinkFirmwareVersion.Version_3_x)
+ assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.0.1")).isEqualTo(RileyLinkFirmwareVersion.Version_3_x)
+ assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.1")).isEqualTo(RileyLinkFirmwareVersion.Version_3_x)
+ assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.1.13")).isEqualTo(RileyLinkFirmwareVersion.Version_3_x)
+ assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.0")).isEqualTo(RileyLinkFirmwareVersion.Version_4_x)
+ assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.0.4")).isEqualTo(RileyLinkFirmwareVersion.Version_4_x)
+ assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.3")).isEqualTo(RileyLinkFirmwareVersion.Version_4_x)
+ assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.5.7")).isEqualTo(RileyLinkFirmwareVersion.Version_4_x)
+ assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.0")).isEqualTo(RileyLinkFirmwareVersion.UnknownVersion)
+ assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.0.0")).isEqualTo(RileyLinkFirmwareVersion.UnknownVersion)
+ assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.5.5")).isEqualTo(RileyLinkFirmwareVersion.UnknownVersion)
}
-}
\ No newline at end of file
+}
diff --git a/pump/virtual/src/main/res/values-no-rNO/strings.xml b/pump/virtual/src/main/res/values-nb-rNO/strings.xml
similarity index 100%
rename from pump/virtual/src/main/res/values-no-rNO/strings.xml
rename to pump/virtual/src/main/res/values-nb-rNO/strings.xml
diff --git a/pump/virtual/src/test/kotlin/app/aaps/pump/virtual/VirtualPumpPluginUTest.kt b/pump/virtual/src/test/kotlin/app/aaps/pump/virtual/VirtualPumpPluginUTest.kt
index ce9dad23db..e928ff25f8 100644
--- a/pump/virtual/src/test/kotlin/app/aaps/pump/virtual/VirtualPumpPluginUTest.kt
+++ b/pump/virtual/src/test/kotlin/app/aaps/pump/virtual/VirtualPumpPluginUTest.kt
@@ -14,7 +14,7 @@ import app.aaps.core.interfaces.utils.DateUtil
import app.aaps.core.interfaces.utils.fabric.FabricPrivacy
import app.aaps.shared.tests.TestBase
import dagger.android.AndroidInjector
-import org.junit.jupiter.api.Assertions
+import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.mockito.Mock
@@ -49,7 +49,7 @@ class VirtualPumpPluginUTest : TestBase() {
fun refreshConfiguration() {
`when`(sp.getString(app.aaps.core.utils.R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo")
virtualPumpPlugin.refreshConfiguration()
- Assertions.assertEquals(PumpType.ACCU_CHEK_COMBO, virtualPumpPlugin.pumpType)
+ assertThat(virtualPumpPlugin.pumpType).isEqualTo(PumpType.ACCU_CHEK_COMBO)
}
@Test
@@ -58,6 +58,6 @@ class VirtualPumpPluginUTest : TestBase() {
virtualPumpPlugin.refreshConfiguration()
`when`(sp.getString(app.aaps.core.utils.R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo")
virtualPumpPlugin.refreshConfiguration()
- Assertions.assertEquals(PumpType.ACCU_CHEK_COMBO, virtualPumpPlugin.pumpType)
+ assertThat(virtualPumpPlugin.pumpType).isEqualTo(PumpType.ACCU_CHEK_COMBO)
}
-}
\ No newline at end of file
+}
diff --git a/ui/src/main/res/values-no-rNO/strings.xml b/ui/src/main/res/values-nb-rNO/strings.xml
similarity index 94%
rename from ui/src/main/res/values-no-rNO/strings.xml
rename to ui/src/main/res/values-nb-rNO/strings.xml
index 2c74e6897f..09efac2ec8 100644
--- a/ui/src/main/res/values-no-rNO/strings.xml
+++ b/ui/src/main/res/values-nb-rNO/strings.xml
@@ -4,9 +4,9 @@
Karbohydrat-begrensning utført
TT
Dialog avbrutt
- Start TT for trening
- Start TT for spise snart
- Start TT for hypoglykemi
+ Start midlertidig mål for Aktivitet
+ Start midlertidig mål for Spise snart
+ Start midlertidig mål for Hypo
Tids- forskyvning
min
Påminnelse om å gi bolus senere
@@ -130,27 +130,27 @@
kun på klokke
kun på telefon
- Innstillinger for hurtigveiviser
+ Innstillinger for hurtigknapp
Knappetekst:
Karbo:
Gyldig:
Legg til
Rediger
Vis oppføring på enhet:
- BS beregning
- Bolus IOB beregning
- Basal IOB beregning
- Trendberegning
- Superbolus beregning
+ BS-beregning
+ Bolus IOB-beregning
+ Basal IOB-beregning
+ Trend-beregning
+ Superbolus-beregning
Prosent
Alt
Telefon
Klokke
Bare positive
Bare negative
- COB beregning
- Beregning av midl. mål
- Prosent beregning
+ COB-beregning
+ Beregning av midlertidig mål
+ Prosent-beregning
Standardverdi
håndtering av dra-og-slipp
diff --git a/wear/src/main/AndroidManifest.xml b/wear/src/main/AndroidManifest.xml
index 837f323a78..0a21c75013 100644
--- a/wear/src/main/AndroidManifest.xml
+++ b/wear/src/main/AndroidManifest.xml
@@ -120,56 +120,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/wear/src/main/kotlin/app/aaps/wear/di/WearServicesModule.kt b/wear/src/main/kotlin/app/aaps/wear/di/WearServicesModule.kt
index ea11f0b81c..9a7f137b0f 100644
--- a/wear/src/main/kotlin/app/aaps/wear/di/WearServicesModule.kt
+++ b/wear/src/main/kotlin/app/aaps/wear/di/WearServicesModule.kt
@@ -24,11 +24,9 @@ import app.aaps.wear.watchfaces.AapsV2Watchface
import app.aaps.wear.watchfaces.AapsWatchface
import app.aaps.wear.watchfaces.BigChartWatchface
import app.aaps.wear.watchfaces.CircleWatchface
-import app.aaps.wear.watchfaces.CockpitWatchface
import app.aaps.wear.watchfaces.CustomWatchface
import app.aaps.wear.watchfaces.DigitalStyleWatchface
import app.aaps.wear.watchfaces.NoChartWatchface
-import app.aaps.wear.watchfaces.SteampunkWatchface
import app.aaps.wear.watchfaces.utils.BaseWatchFace
import dagger.Module
import dagger.android.ContributesAndroidInjector
@@ -57,9 +55,7 @@ abstract class WearServicesModule {
@ContributesAndroidInjector abstract fun contributesAapsWatchface(): AapsWatchface
@ContributesAndroidInjector abstract fun contributesAapsV2Watchface(): AapsV2Watchface
@ContributesAndroidInjector abstract fun contributesAapsLargeWatchface(): AapsLargeWatchface
- @ContributesAndroidInjector abstract fun contributesSteampunk(): SteampunkWatchface
@ContributesAndroidInjector abstract fun contributesDigitalStyleWatchface(): DigitalStyleWatchface
- @ContributesAndroidInjector abstract fun contributesCockpitWatchface(): CockpitWatchface
@ContributesAndroidInjector abstract fun contributesBIGChart(): BigChartWatchface
@ContributesAndroidInjector abstract fun contributesNOChart(): NoChartWatchface
@ContributesAndroidInjector abstract fun contributesCircleWatchface(): CircleWatchface
diff --git a/wear/src/main/kotlin/app/aaps/wear/watchfaces/CockpitWatchface.kt b/wear/src/main/kotlin/app/aaps/wear/watchfaces/CockpitWatchface.kt
deleted file mode 100644
index 7c0ac08220..0000000000
--- a/wear/src/main/kotlin/app/aaps/wear/watchfaces/CockpitWatchface.kt
+++ /dev/null
@@ -1,78 +0,0 @@
-package app.aaps.wear.watchfaces
-
-import android.view.LayoutInflater
-import android.view.View
-import androidx.viewbinding.ViewBinding
-import app.aaps.wear.R
-import app.aaps.wear.databinding.ActivityCockpitBinding
-import app.aaps.wear.watchfaces.utils.BaseWatchFace
-
-/**
- * Created by andrew-warrington on 18/11/2017.
- * Refactored by MilosKozak 24/04/2022
- */
-class CockpitWatchface : BaseWatchFace() {
-
- private lateinit var binding: ActivityCockpitBinding
-
- override fun inflateLayout(inflater: LayoutInflater): ViewBinding {
- binding = ActivityCockpitBinding.inflate(inflater)
- return binding
- }
-
- override fun setColorDark() {
- binding.mainLayout.setBackgroundResource(R.drawable.airplane_cockpit_outside_clouds)
- setTextSizes()
- val led = when (singleBg.sgvLevel) {
- 1L -> R.drawable.airplane_led_yellow_lit
- 0L -> R.drawable.airplane_led_grey_unlit
- -1L -> R.drawable.airplane_led_red_lit
- else -> R.drawable.airplane_led_grey_unlit
- }
-
- binding.highLight.setBackgroundResource(led)
- binding.lowLight.setBackgroundResource(led)
-
- when (loopLevel) {
- -1 -> binding.loop.setBackgroundResource(R.drawable.loop_grey_25)
- 1 -> binding.loop.setBackgroundResource(R.drawable.loop_green_25)
- else -> binding.loop.setBackgroundResource(R.drawable.loop_red_25)
- }
- invalidate()
- }
-
- override fun setColorLowRes() {
- binding.mainLayout.setBackgroundResource(R.drawable.airplane_cockpit_outside_clouds_lowres)
- }
-
- override fun setColorBright() {
- setColorDark()
- }
-
- private fun setTextSizes() {
- if (detailedIob) {
- if (bIsRound) binding.iob2.textSize = 10f
- else binding.iob2.textSize = 9f
- } else {
- if (bIsRound) binding.iob2.textSize = 13f
- else binding.iob2.textSize = 12f
- }
- if (binding.uploaderBattery.visibility != View.GONE && binding.rigBattery.visibility != View.GONE) {
- if (bIsRound) {
- binding.uploaderBattery.textSize = 12f
- binding.rigBattery.textSize = 12f
- } else {
- binding.uploaderBattery.textSize = 10f
- binding.rigBattery.textSize = 10f
- }
- } else {
- if (bIsRound) {
- binding.uploaderBattery.textSize = 13f
- binding.rigBattery.textSize = 13f
- } else {
- binding.uploaderBattery.textSize = 12f
- binding.rigBattery.textSize = 12f
- }
- }
- }
-}
diff --git a/wear/src/main/kotlin/app/aaps/wear/watchfaces/CustomWatchface.kt b/wear/src/main/kotlin/app/aaps/wear/watchfaces/CustomWatchface.kt
index 9e8f5da1e5..345812cb27 100644
--- a/wear/src/main/kotlin/app/aaps/wear/watchfaces/CustomWatchface.kt
+++ b/wear/src/main/kotlin/app/aaps/wear/watchfaces/CustomWatchface.kt
@@ -48,10 +48,12 @@ import app.aaps.core.interfaces.rx.weardata.isEquals
import app.aaps.wear.R
import app.aaps.wear.databinding.ActivityCustomBinding
import app.aaps.wear.watchfaces.utils.BaseWatchFace
+import org.joda.time.DateTime
import org.joda.time.TimeOfDay
import org.json.JSONObject
import java.io.ByteArrayOutputStream
import javax.inject.Inject
+import kotlin.math.floor
@SuppressLint("UseCompatLoadingForDrawables")
class CustomWatchface : BaseWatchFace() {
@@ -63,6 +65,8 @@ class CustomWatchface : BaseWatchFace() {
private val TEMPLATE_RESOLUTION = 400
private var lowBatColor = Color.RED
private var resDataMap: CwfResDataMap = mutableMapOf()
+ private var json = JSONObject()
+ private var jsonString = ""
private val bgColor: Int
get() = when (singleBg.sgvLevel) {
1L -> highColor
@@ -102,18 +106,20 @@ class CustomWatchface : BaseWatchFace() {
override fun setColorDark() {
setWatchfaceStyle()
- binding.sgv.setTextColor(bgColor)
- binding.direction2.colorFilter = changeDrawableColor(bgColor)
-
- if (ageLevel != 1)
+ if ((ViewMap.SGV.dynData?.stepColor ?: 0) == 0)
+ binding.sgv.setTextColor(bgColor)
+ if ((ViewMap.DIRECTION.dynData?.stepColor ?: 0) == 0)
+ binding.direction2.colorFilter = changeDrawableColor(bgColor)
+ if (ageLevel != 1 && (ViewMap.TIMESTAMP.dynData?.stepColor ?: 0) == 0)
binding.timestamp.setTextColor(ContextCompat.getColor(this, R.color.dark_TimestampOld))
- if (status.batteryLevel != 1)
+ if (status.batteryLevel != 1 && (ViewMap.UPLOADER_BATTERY.dynData?.stepColor ?: 0) == 0)
binding.uploaderBattery.setTextColor(lowBatColor)
- when (loopLevel) {
- -1 -> binding.loop.setBackgroundResource(R.drawable.loop_grey_25)
- 1 -> binding.loop.setBackgroundResource(R.drawable.loop_green_25)
- else -> binding.loop.setBackgroundResource(R.drawable.loop_red_25)
- }
+ if ((ViewMap.LOOP.dynData?.stepDraw ?: 0) == 0) // Apply automatic background image only if no dynData or no step images
+ when (loopLevel) {
+ -1 -> binding.loop.setBackgroundResource(R.drawable.loop_grey_25)
+ 1 -> binding.loop.setBackgroundResource(R.drawable.loop_green_25)
+ else -> binding.loop.setBackgroundResource(R.drawable.loop_red_25)
+ }
setupCharts()
}
@@ -146,12 +152,14 @@ class CustomWatchface : BaseWatchFace() {
customWatchface?.let {
updatePref(it.customWatchfaceData.metadata)
try {
- val json = JSONObject(it.customWatchfaceData.json)
- if (!resDataMap.isEquals(it.customWatchfaceData.resDatas)) {
+ json = JSONObject(it.customWatchfaceData.json)
+ if (!resDataMap.isEquals(it.customWatchfaceData.resDatas) || jsonString != it.customWatchfaceData.json) {
resDataMap = it.customWatchfaceData.resDatas
+ jsonString = it.customWatchfaceData.json
FontMap.init(this)
ViewMap.init(this)
TrendArrowMap.init(this)
+ DynProvider.init(json.optJSONObject(DYNDATA.key))
}
enableSecond = json.optBoolean(ENABLESECOND.key) && sp.getBoolean(R.string.key_show_seconds, true)
highColor = getColor(json.optString(HIGHCOLOR.key), ContextCompat.getColor(this, R.color.dark_highColor))
@@ -170,17 +178,11 @@ class CustomWatchface : BaseWatchFace() {
binding.mainLayout.forEach { view ->
ViewMap.fromId(view.id)?.let { viewMap ->
- json.optJSONObject(viewMap.key)?.also { viewJson ->
- when (view) {
- is TextView -> viewMap.customizeTextView(view, viewJson)
- is ImageView -> viewMap.customizeImageView(view, viewJson)
- else -> viewMap.customizeViewCommon(view, viewJson)
- }
- } ?: apply {
- view.visibility = View.GONE
- if (view is TextView) {
- view.text = ""
- }
+ when (view) {
+ is TextView -> viewMap.customizeTextView(view)
+ is ImageView -> viewMap.customizeImageView(view)
+ is lecho.lib.hellocharts.view.LineChartView -> viewMap.customizeGraphView(view)
+ else -> viewMap.customizeViewCommon(view)
}
}
}
@@ -437,8 +439,11 @@ class CustomWatchface : BaseWatchFace() {
it.highCustom = null
it.lowCustom = null
it.textDrawable = null
+ it.viewJson = null
+ it.twinView = null
}
fun fromId(id: Int): ViewMap? = values().firstOrNull { it.id == id }
+ fun fromKey(key: String?): ViewMap? = values().firstOrNull { it.key == key }
}
lateinit var cwf: CustomWatchface
@@ -446,6 +451,11 @@ class CustomWatchface : BaseWatchFace() {
var height = 0
var left = 0
var top = 0
+ var viewJson: JSONObject? = null
+ get() = field ?: cwf.json.optJSONObject(key)?.also { viewJson = it }
+ val visibility: Int
+ get() = viewJson?.let { cwf.setVisibility(it.optString(VISIBILITY.key, JsonKeyValues.GONE.key), visibility()) } ?: View.GONE
+ var dynData: DynProvider? = null
var rangeCustom: Drawable? = null
get() = field ?: customDrawable?.let { cd -> cwf.resDataMap[cd.fileName]?.toDrawable(cwf.resources).also { rangeCustom = it } }
var highCustom: Drawable? = null
@@ -454,84 +464,108 @@ class CustomWatchface : BaseWatchFace() {
get() = field ?: customLow?.let { cd -> cwf.resDataMap[cd.fileName]?.toDrawable(cwf.resources).also { lowCustom = it } }
var textDrawable: Drawable? = null
val drawable: Drawable?
- get() = when (cwf.singleBg.sgvLevel) {
+ get() = dynData?.getDrawable() ?: when (cwf.singleBg.sgvLevel) {
1L -> highCustom ?: rangeCustom
0L -> rangeCustom
-1L -> lowCustom ?: rangeCustom
else -> rangeCustom
}
+ var twinView: ViewMap? = null
+ get() = field ?: viewJson?.let { viewJson -> ViewMap.fromKey(viewJson.optString(TWINVIEW.key)).also { twinView = it } }
fun visibility(): Boolean = this.pref?.let { cwf.sp.getBoolean(it, true) }
?: true
- fun textDrawable(viewJson: JSONObject): Drawable? = textDrawable
- ?: cwf.resDataMap[viewJson.optString(JsonKeys.BACKGROUND.key)]?.toDrawable(cwf.resources, width, height)?.also { textDrawable = it }
+ fun textDrawable(): Drawable? = textDrawable
+ ?: cwf.resDataMap[viewJson?.optString(JsonKeys.BACKGROUND.key)]?.toDrawable(cwf.resources, width, height)?.also { textDrawable = it }
- fun customizeViewCommon(view: View, viewJson: JSONObject) {
- width = (viewJson.optInt(WIDTH.key) * cwf.zoomFactor).toInt()
- height = (viewJson.optInt(HEIGHT.key) * cwf.zoomFactor).toInt()
- left = (viewJson.optInt(LEFTMARGIN.key) * cwf.zoomFactor).toInt()
- top = (viewJson.optInt(TOPMARGIN.key) * cwf.zoomFactor).toInt()
- val params = FrameLayout.LayoutParams(width, height)
- params.topMargin = top
- params.leftMargin = left
- view.layoutParams = params
- view.visibility = cwf.setVisibility(viewJson.optString(VISIBILITY.key, JsonKeyValues.GONE.key), visibility())
+ fun customizeViewCommon(view: View) {
+ view.visibility = visibility
+ viewJson?.let {viewJson ->
+ width = (viewJson.optInt(WIDTH.key) * cwf.zoomFactor).toInt()
+ height = (viewJson.optInt(HEIGHT.key) * cwf.zoomFactor).toInt()
+ left = (viewJson.optInt(LEFTMARGIN.key) * cwf.zoomFactor).toInt()
+ top = (viewJson.optInt(TOPMARGIN.key) * cwf.zoomFactor).toInt()
+ val params = FrameLayout.LayoutParams(width, height)
+ dynData = DynProvider.getDyn(cwf, viewJson.optString(DYNDATA.key), width, height, key)
+ val topOffset = if (viewJson.optBoolean(TOPOFFSET.key, false)) dynData?.getTopOffset() ?: 0 else 0
+ val topOffsetTwin = ((twinView?.let { if (it.visibility != View.VISIBLE) viewJson.optInt(TOPOFFSETTWINHIDDEN.key,0) else 0 } ?: 0 ) * cwf.zoomFactor).toInt()
+ params.topMargin = top + topOffset + topOffsetTwin
+ val leftOffset = if (viewJson.optBoolean(LEFTOFFSET.key, false)) dynData?.getLeftOffset() ?: 0 else 0
+ val leftOffsetTwin = ((twinView?.let { if (it.visibility != View.VISIBLE) viewJson.optInt(LEFTOFFSETTWINHIDDEN.key,0) else 0 } ?: 0) * cwf.zoomFactor).toInt()
+ params.leftMargin = left + leftOffset + leftOffsetTwin
+ view.layoutParams = params
+ val rotationOffset = if (viewJson.optBoolean(ROTATIONOFFSET.key, false)) dynData?.getRotationOffset()?.toFloat() ?: 0F else 0F
+ view.rotation = viewJson.optInt(ROTATION.key).toFloat() + rotationOffset
+ }
}
- fun customizeTextView(view: TextView, viewJson: JSONObject) {
- customizeViewCommon(view, viewJson)
- view.rotation = viewJson.optInt(ROTATION.key).toFloat()
- view.setTextSize(TypedValue.COMPLEX_UNIT_PX, (viewJson.optInt(TEXTSIZE.key, 22) * cwf.zoomFactor).toFloat())
- view.gravity = GravityMap.gravity(viewJson.optString(GRAVITY.key, GravityMap.CENTER.key))
- view.setTypeface(
- FontMap.font(viewJson.optString(FONT.key, FontMap.DEFAULT.key)),
- StyleMap.style(viewJson.optString(FONTSTYLE.key, StyleMap.NORMAL.key))
- )
- view.setTextColor(cwf.getColor(viewJson.optString(FONTCOLOR.key)))
- view.isAllCaps = viewJson.optBoolean(ALLCAPS.key)
- if (viewJson.has(TEXTVALUE.key))
- view.text = viewJson.optString(TEXTVALUE.key)
- view.background = textDrawable(viewJson)
+ fun customizeTextView(view: TextView) {
+ customizeViewCommon(view)
+ viewJson?.let { viewJson ->
+ view.setTextSize(TypedValue.COMPLEX_UNIT_PX, (viewJson.optInt(TEXTSIZE.key, 22) * cwf.zoomFactor).toFloat())
+ view.gravity = GravityMap.gravity(viewJson.optString(GRAVITY.key, GravityMap.CENTER.key))
+ view.setTypeface(
+ FontMap.font(viewJson.optString(FONT.key, FontMap.DEFAULT.key)),
+ StyleMap.style(viewJson.optString(FONTSTYLE.key, StyleMap.NORMAL.key))
+ )
+ view.setTextColor(dynData?.getColor() ?: cwf.getColor(viewJson.optString(FONTCOLOR.key)))
+ view.isAllCaps = viewJson.optBoolean(ALLCAPS.key)
+ if (viewJson.has(TEXTVALUE.key))
+ view.text = viewJson.optString(TEXTVALUE.key)
+ view.background = dynData?.getDrawable() ?: textDrawable()
+ } ?: apply { view.text = "" }
}
- fun customizeImageView(view: ImageView, viewJson: JSONObject) {
- customizeViewCommon(view, viewJson)
+ fun customizeImageView(view: ImageView) {
+ customizeViewCommon(view)
view.clearColorFilter()
- drawable?.let {
- if (viewJson.has(COLOR.key)) // Note only works on bitmap (png or jpg) or xml included into res, not for svg files
- it.colorFilter = cwf.changeDrawableColor(cwf.getColor(viewJson.optString(COLOR.key)))
- else
- it.clearColorFilter()
- view.setImageDrawable(it)
- } ?: apply {
- view.setImageDrawable(defaultDrawable?.let { cwf.resources.getDrawable(it) })
- if (viewJson.has(COLOR.key))
- view.setColorFilter(cwf.getColor(viewJson.optString(COLOR.key)))
- else
- view.clearColorFilter()
+ viewJson?.let { viewJson ->
+ drawable?.let {
+ if (viewJson.has(COLOR.key) || (dynData?.stepColor ?: 0) > 0) // Note only works on bitmap (png or jpg) or xml included into res, not for svg files
+ it.colorFilter = cwf.changeDrawableColor(dynData?.getColor() ?: cwf.getColor(viewJson.optString(COLOR.key)))
+ else
+ it.clearColorFilter()
+ view.setImageDrawable(it)
+ } ?: apply {
+ view.setImageDrawable(defaultDrawable?.let { cwf.resources.getDrawable(it) })
+ if (viewJson.has(COLOR.key) || (dynData?.stepColor ?: 0) > 0)
+ view.setColorFilter(dynData?.getColor() ?: cwf.getColor(viewJson.optString(COLOR.key)))
+ else
+ view.clearColorFilter()
+ }
+ }
+ }
+
+ fun customizeGraphView(view: lecho.lib.hellocharts.view.LineChartView) {
+ customizeViewCommon(view)
+ viewJson?.let { viewJson ->
+ view.setBackgroundColor(dynData?.getColor() ?: cwf.getColor(viewJson.optString(COLOR.key, "#0000000000"), Color.TRANSPARENT))
+ view.background = dynData?.getDrawable() ?: textDrawable()
}
}
}
- private enum class TrendArrowMap(val symbol: String, @DrawableRes val icon: Int, val customDrawable: ResFileMap?) {
- NONE("??", R.drawable.ic_invalid, ResFileMap.ARROW_NONE),
- TRIPLE_UP("X", R.drawable.ic_doubleup, ResFileMap.ARROW_DOUBLE_UP),
- DOUBLE_UP("\u21c8", R.drawable.ic_doubleup, ResFileMap.ARROW_DOUBLE_UP),
- SINGLE_UP("\u2191", R.drawable.ic_singleup, ResFileMap.ARROW_SINGLE_UP),
- FORTY_FIVE_UP("\u2197", R.drawable.ic_fortyfiveup, ResFileMap.ARROW_FORTY_FIVE_UP),
- FLAT("\u2192", R.drawable.ic_flat, ResFileMap.ARROW_FLAT),
- FORTY_FIVE_DOWN("\u2198", R.drawable.ic_fortyfivedown, ResFileMap.ARROW_FORTY_FIVE_DOWN),
- SINGLE_DOWN("\u2193", R.drawable.ic_singledown, ResFileMap.ARROW_SINGLE_DOWN),
- DOUBLE_DOWN("\u21ca", R.drawable.ic_doubledown, ResFileMap.ARROW_DOUBLE_DOWN),
- TRIPLE_DOWN("X", R.drawable.ic_doubledown, ResFileMap.ARROW_DOUBLE_DOWN);
+ private enum class TrendArrowMap(val symbol: String, @DrawableRes val icon: Int, val customDrawable: ResFileMap?, val dynValue: Double) {
+ NONE("??", R.drawable.ic_invalid, ResFileMap.ARROW_NONE, 0.0),
+ TRIPLE_UP("X", R.drawable.ic_doubleup, ResFileMap.ARROW_DOUBLE_UP, 7.0),
+ DOUBLE_UP("\u21c8", R.drawable.ic_doubleup, ResFileMap.ARROW_DOUBLE_UP, 7.0),
+ SINGLE_UP("\u2191", R.drawable.ic_singleup, ResFileMap.ARROW_SINGLE_UP, 6.0),
+ FORTY_FIVE_UP("\u2197", R.drawable.ic_fortyfiveup, ResFileMap.ARROW_FORTY_FIVE_UP, 5.0),
+ FLAT("\u2192", R.drawable.ic_flat, ResFileMap.ARROW_FLAT, 4.0),
+ FORTY_FIVE_DOWN("\u2198", R.drawable.ic_fortyfivedown, ResFileMap.ARROW_FORTY_FIVE_DOWN, 3.0),
+ SINGLE_DOWN("\u2193", R.drawable.ic_singledown, ResFileMap.ARROW_SINGLE_DOWN, 2.0),
+ DOUBLE_DOWN("\u21ca", R.drawable.ic_doubledown, ResFileMap.ARROW_DOUBLE_DOWN, 2.0),
+ TRIPLE_DOWN("X", R.drawable.ic_doubledown, ResFileMap.ARROW_DOUBLE_DOWN, 1.0);
companion object {
fun init(cwf: CustomWatchface) = values().forEach {
it.cwf = cwf
it.arrowCustom = null
+
}
fun drawable() = values().firstOrNull { it.symbol == it.cwf.singleBg.slopeArrow }?.arrowCustom ?: NONE.arrowCustom
+ fun value() = values().firstOrNull { it.symbol == it.cwf.singleBg.slopeArrow }?.dynValue ?: NONE.dynValue
}
lateinit var cwf: CustomWatchface
@@ -618,6 +652,131 @@ class CustomWatchface : BaseWatchFace() {
SHOW_LOOP_STATUS(CwfMetadataKey.CWF_PREF_WATCH_SHOW_LOOP_STATUS.key, R.string.key_show_external_status),
SHOW_WEEK_NUMBER(CwfMetadataKey.CWF_PREF_WATCH_SHOW_WEEK_NUMBER.key, R.string.key_show_week_number)
}
+
+ private enum class ValueMap(val key: String, val min: Double, val max: Double) {
+ SGV(ViewKeys.SGV.key, 39.0, 400.0),
+ SGVLEVEL(JsonKeyValues.SGVLEVEL.key, -1.0, 1.0),
+ DIRECTION(ViewKeys.DIRECTION.key, 1.0, 7.0),
+ DELTA(ViewKeys.DELTA.key, -25.0, 25.0),
+ AVG_DELTA(ViewKeys.AVG_DELTA.key, -25.0, 25.0),
+ UPLOADER_BATTERY(ViewKeys.UPLOADER_BATTERY.key, 0.0, 100.0),
+ RIG_BATTERY(ViewKeys.RIG_BATTERY.key, 0.0, 100.0),
+ TIMESTAMP(ViewKeys.TIMESTAMP.key, 0.0, 60.0),
+ LOOP(ViewKeys.LOOP.key, 0.0, 28.0),
+ DAY(ViewKeys.DAY.key, 1.0, 31.0),
+ DAY_NAME(ViewKeys.DAY_NAME.key, 1.0, 7.0),
+ MONTH(ViewKeys.MONTH.key, 1.0, 12.0),
+ WEEKNUMBER(ViewKeys.WEEKNUMBER.key, 1.0, 53.0);
+
+ fun dynValue(dataValue: Double, dataRange: DataRange, valueRange: DataRange): Int = when {
+ dataValue < dataRange.minData -> dataRange.minData
+ dataValue > dataRange.maxData -> dataRange.maxData
+ else -> dataValue
+ }.let {
+ if (dataRange.minData != dataRange.maxData)
+ (valueRange.minData + (it - dataRange.minData) * (valueRange.maxData - valueRange.minData) / (dataRange.maxData - dataRange.minData)).toInt()
+ else it.toInt()
+ }
+
+ fun stepValue(dataValue: Double, range: DataRange, step: Int): Int = step(dataValue, range, step)
+ private fun step(dataValue: Double, dataRange: DataRange, step: Int): Int = when {
+ dataValue < dataRange.minData -> dataRange.minData
+ dataValue >= dataRange.maxData -> dataRange.maxData * 0.9999 // to avoid dataValue == maxData and be out of range
+ else -> dataValue
+ }.let { if (dataRange.minData != dataRange.maxData) (1 + ((it - dataRange.minData) * step) / (dataRange.maxData - dataRange.minData)).toInt() else 0 }
+
+ companion object {
+
+ fun fromKey(key: String) = values().firstOrNull { it.key == key }
+ }
+ }
+
+ private class DynProvider(val cwf: CustomWatchface, val dataJson: JSONObject, val valueMap: ValueMap, val width: Int, val height: Int) {
+
+ private val dynDrawable = mutableMapOf()
+ private val dynColor = mutableMapOf()
+ private var dataRange: DataRange? = null
+ private var topRange: DataRange? = null
+ private var leftRange: DataRange? = null
+ private var rotationRange: DataRange? = null
+ val stepDraw: Int
+ get() = dynDrawable.size - 1
+ val stepColor: Int
+ get() = dynColor.size - 1
+
+ val dataValue: Double?
+ get() = when (valueMap) {
+ ValueMap.SGV -> if (cwf.singleBg.sgvString != "---") cwf.singleBg.sgv else null
+ ValueMap.SGVLEVEL -> if (cwf.singleBg.sgvString != "---") cwf.singleBg.sgvLevel.toDouble() else null
+ ValueMap.DIRECTION -> TrendArrowMap.value()
+ ValueMap.DELTA -> cwf.singleBg.deltaMgdl
+ ValueMap.AVG_DELTA -> cwf.singleBg.avgDeltaMgdl
+ ValueMap.RIG_BATTERY -> cwf.status.rigBattery.replace("%", "").toDoubleOrNull()
+ ValueMap.UPLOADER_BATTERY -> cwf.status.battery.replace("%", "").toDoubleOrNull()
+ ValueMap.LOOP -> if (cwf.status.openApsStatus != -1L) ((System.currentTimeMillis() - cwf.status.openApsStatus) / 1000 / 60).toDouble() else null
+ ValueMap.TIMESTAMP -> if (cwf.singleBg.timeStamp != 0L) floor(cwf.timeSince() / (1000 * 60)) else null
+ ValueMap.DAY -> DateTime().dayOfMonth.toDouble()
+ ValueMap.DAY_NAME -> DateTime().dayOfWeek.toDouble()
+ ValueMap.MONTH -> DateTime().monthOfYear.toDouble()
+ ValueMap.WEEKNUMBER -> DateTime().weekOfWeekyear.toDouble()
+ }
+
+ fun getTopOffset(): Int = dataRange?.let { dataRange -> topRange?.let { topRange -> dataValue?.let { (valueMap.dynValue(it, dataRange, topRange) * cwf.zoomFactor).toInt() }
+ ?: (topRange.invalidData * cwf.zoomFactor).toInt() } } ?: 0
+ fun getLeftOffset(): Int = dataRange?.let { dataRange -> leftRange?.let { leftRange -> dataValue?.let { (valueMap.dynValue(it, dataRange, leftRange) * cwf.zoomFactor).toInt() }
+ ?: (leftRange.invalidData * cwf.zoomFactor).toInt() } } ?: 0
+ fun getRotationOffset(): Int = dataRange?.let { dataRange -> rotationRange?.let { rotRange -> dataValue?.let { valueMap.dynValue(it, dataRange, rotRange) } ?: rotRange.invalidData } } ?: 0
+ fun getDrawable() = dataRange?.let { dataRange -> dataValue?.let { dynDrawable[valueMap.stepValue(it, dataRange, stepDraw)] } ?: dynDrawable[0] }
+ fun getColor() = if (stepColor > 0) dataRange?.let { dataRange -> dataValue?.let { dynColor[valueMap.stepValue(it, dataRange, stepColor)] } ?: dynColor[0] } else null
+ private fun load() {
+ dynDrawable[0] = dataJson.optString(INVALIDIMAGE.key)?.let { cwf.resDataMap[it]?.toDrawable(cwf.resources, width, height) }
+ var idx = 1
+ while (dataJson.has("${IMAGE.key}$idx")) {
+ cwf.resDataMap[dataJson.optString("${IMAGE.key}$idx")]?.toDrawable(cwf.resources, width, height).also { dynDrawable[idx] = it }
+ idx++
+ }
+ dynColor[0] = cwf.getColor(dataJson.optString(INVALIDCOLOR.key))
+ idx = 1
+ while (dataJson.has("${COLOR.key}$idx")) {
+ dynColor[idx] = cwf.getColor(dataJson.optString("${COLOR.key}$idx"))
+ idx++
+ }
+ DataRange(dataJson.optDouble(MINDATA.key, valueMap.min), dataJson.optDouble(MAXDATA.key, valueMap.max)).let { defaultRange ->
+ dataRange = defaultRange
+ topRange = parseDataRange(dataJson.optJSONObject(TOPOFFSET.key), defaultRange)
+ leftRange = parseDataRange(dataJson.optJSONObject(LEFTOFFSET.key), defaultRange)
+ rotationRange = parseDataRange(dataJson.optJSONObject(ROTATIONOFFSET.key), defaultRange)
+ }
+ }
+
+ companion object {
+
+ val dynData = mutableMapOf()
+ var dynJson: JSONObject? = null
+ fun init(dynJson: JSONObject?) {
+ this.dynJson = dynJson
+ dynData.clear()
+ }
+
+ fun getDyn(cwf: CustomWatchface, key: String, width: Int, height: Int, defaultViewKey: String): DynProvider? = dynData["${defaultViewKey}_$key"]
+ ?: dynJson?.optJSONObject(key)?.let { dataJson ->
+ ValueMap.fromKey(dataJson.optString(VALUEKEY.key, defaultViewKey))?.let { valueMap ->
+ DynProvider(cwf, dataJson, valueMap, width, height).also { it.load() }
+ }
+ }?.also { dynData["${defaultViewKey}_$key"] = it }
+
+ private fun parseDataRange(json: JSONObject?, defaultData: DataRange) =
+ json?.let {
+ DataRange(
+ minData = it.optDouble(MINVALUE.key, defaultData.minData),
+ maxData = it.optDouble(MAXVALUE.key, defaultData.maxData),
+ invalidData = it.optInt(INVALIDVALUE.key, defaultData.invalidData)
+ )
+ } ?: defaultData
+ }
+ }
+
+ private class DataRange (val minData: Double, val maxData: Double, val invalidData: Int = 0)
}
diff --git a/wear/src/main/kotlin/app/aaps/wear/watchfaces/SteampunkWatchface.kt b/wear/src/main/kotlin/app/aaps/wear/watchfaces/SteampunkWatchface.kt
deleted file mode 100644
index 8ff5365b2b..0000000000
--- a/wear/src/main/kotlin/app/aaps/wear/watchfaces/SteampunkWatchface.kt
+++ /dev/null
@@ -1,169 +0,0 @@
-@file:Suppress("DEPRECATION")
-
-package app.aaps.wear.watchfaces
-
-import android.view.LayoutInflater
-import android.view.animation.Animation
-import android.view.animation.LinearInterpolator
-import android.view.animation.RotateAnimation
-import androidx.core.content.ContextCompat
-import androidx.viewbinding.ViewBinding
-import app.aaps.wear.R
-import app.aaps.wear.databinding.ActivitySteampunkBinding
-import app.aaps.wear.watchfaces.utils.BaseWatchFace
-import org.joda.time.TimeOfDay
-
-/**
- * Created by andrew-warrington on 01/12/2017.
- * Refactored by MilosKozak on 23/04/2022
- */
-class SteampunkWatchface : BaseWatchFace() {
-
- private var lastEndDegrees = 0f
- private var deltaRotationAngle = 0f
- private lateinit var binding: ActivitySteampunkBinding
-
- override fun inflateLayout(inflater: LayoutInflater): ViewBinding {
- binding = ActivitySteampunkBinding.inflate(inflater)
- return binding
- }
-
- override fun onCreate() {
- forceSquareCanvas = true
- super.onCreate()
- }
-
- override fun setColorDark() {
- if (ageLevel() <= 0 && singleBg.timeStamp != 0L) {
- binding.tertiaryLayout.setBackgroundResource(R.drawable.redline)
- binding.timestamp.setTextColor(ContextCompat.getColor(this, R.color.red_600))
- } else {
- binding.tertiaryLayout.setBackgroundResource(0)
- binding.timestamp.setTextColor(ContextCompat.getColor(this, android.support.wearable.R.color.black_86p))
- }
- binding.loop.setTextColor(ContextCompat.getColor(this, if (loopLevel == 0) R.color.red_600 else android.support.wearable.R.color.black_86p))
- if (singleBg.sgvString != "---") {
- var rotationAngle = 0f // by default, show ? on the dial (? is at 0 degrees on the dial)
- if (singleBg.glucoseUnits != "-") {
-
- // ensure the glucose dial is the correct units
- binding.glucoseDial.setImageResource(if (singleBg.glucoseUnits == "mmol") R.drawable.steampunk_dial_mmol else R.drawable.steampunk_dial_mgdl)
-
- // convert the Sgv to degrees of rotation
- rotationAngle = singleBg.sgv.toFloat()
- }
- if (rotationAngle > 330) rotationAngle = 330f // if the glucose value is higher than 330 then show "HIGH" on the dial. ("HIGH" is at 330 degrees on the dial)
- if (rotationAngle != 0f && rotationAngle < 30) rotationAngle = 30f // if the glucose value is lower than 30 show "LOW" on the dial. ("LOW" is at 30 degrees on the dial)
- if (lastEndDegrees == 0f) lastEndDegrees = rotationAngle
-
- // rotate glucose dial
- val rotate = RotateAnimation(lastEndDegrees, rotationAngle - lastEndDegrees, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f).apply {
- fillAfter = true
- interpolator = LinearInterpolator()
- duration = 1
- }
- binding.glucoseDial.startAnimation(rotate)
- lastEndDegrees = rotationAngle //store the final angle as a starting point for the next rotation.
- }
-
- singleBg.avgDeltaMgdl?.let {// if a legitimate delta value is
- val absAvgDelta = it.toFloat()
- var autoGranularity = "0" //auto-granularity off
- // ensure the delta gauge is the right units and granularity
- if (sp.getString("delta_granularity", "2") == "4") { //Auto granularity
- autoGranularity =
- when {
- absAvgDelta < 5 -> "3" // high if below 5 mg/dl
- absAvgDelta < 10 -> "2" // medium if below 10 mg/dl
- else -> "1" // low (init)
- }
- }
- if (sp.getString("delta_granularity", "2") == "1" || autoGranularity == "1") { //low
- if (singleBg.glucoseUnits == "mmol")
- binding.secondaryLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_10)
- else
- binding.secondaryLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_20)
- deltaRotationAngle = absAvgDelta * 1.5f
- }
- if (sp.getString("delta_granularity", "2") == "2" || autoGranularity == "2") { //medium
- if (singleBg.glucoseUnits == "mmol")
- binding.secondaryLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_05)
- else
- binding.secondaryLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_10)
- deltaRotationAngle = absAvgDelta * 3f
- }
- if (sp.getString("delta_granularity", "2") == "3" || autoGranularity == "3") { //high
- if (singleBg.glucoseUnits == "mmol")
- binding.secondaryLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_03)
- else
- binding.secondaryLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_5)
- deltaRotationAngle = absAvgDelta * 6f
- }
- if (deltaRotationAngle > 40) deltaRotationAngle = 40f
- binding.deltaPointer.rotation = deltaRotationAngle
- }
-
- // rotate the minute hand.
- binding.minuteHand.rotation = TimeOfDay().minuteOfHour * 6f
-
- // rotate the hour hand.
- binding.hourHand.rotation = TimeOfDay().hourOfDay * 30f + TimeOfDay().minuteOfHour * 0.5f
- setTextSizes()
- binding.loop.setBackgroundResource(0)
-
- highColor = ContextCompat.getColor(this, R.color.black)
- lowColor = ContextCompat.getColor(this, R.color.black)
- midColor = ContextCompat.getColor(this, R.color.black)
- gridColor = ContextCompat.getColor(this, R.color.grey_steampunk)
- basalBackgroundColor = ContextCompat.getColor(this, R.color.basal_dark)
- basalCenterColor = ContextCompat.getColor(this, R.color.basal_dark)
- pointSize = if (sp.getInt(R.string.key_chart_time_frame, 3) < 3) 2 else 1
- setupCharts()
-
- invalidate()
- }
-
- override fun setColorLowRes() {
- setColorDark()
- }
-
- override fun setColorBright() {
- setColorDark()
- }
-
- private fun setTextSizes() {
- var fontSmall = 10f
- var fontMedium = 11f
- var fontLarge = 12f
- if (bIsRound) {
- fontSmall = 11f
- fontMedium = 12f
- fontLarge = 13f
- }
-
- // top row. large font unless text too big (i.e. detailedIOB)
- binding.cob2.textSize = fontLarge
- binding.basalRate.textSize = fontLarge
- val fontIob = if (status.iobDetail.length < 7) fontLarge else fontSmall
- binding.iob2.textSize = fontIob
-
- // bottom row. font medium unless text too long (i.e. longer than 9' timestamp)
- // always resize these fields together, for symmetry.
- val font = if (binding.timestamp.text.length < 3 || binding.loop.text.length < 3) fontMedium else fontSmall
- binding.loop.textSize = font
- binding.timestamp.textSize = font
-
- // if both batteries are shown, make them smaller.
- val fontBat = if (sp.getBoolean(R.string.key_show_uploader_battery, true) && sp.getBoolean(R.string.key_show_rig_battery, false)) fontSmall else fontMedium
- binding.uploaderBattery.textSize = fontBat
- binding.rigBattery.textSize = fontBat
-
- }
-
- override fun changeChartTimeframe() {
- var timeframe = sp.getInt(R.string.key_chart_time_frame, 3)
- timeframe = timeframe % 5 + 1
- pointSize = if (timeframe < 3) 2 else 1
- sp.putString(R.string.key_chart_time_frame, timeframe.toString())
- }
-}
diff --git a/wear/src/main/kotlin/app/aaps/wear/watchfaces/utils/WatchfaceViewAdapter.kt b/wear/src/main/kotlin/app/aaps/wear/watchfaces/utils/WatchfaceViewAdapter.kt
index 88e365096b..18c06f1ef1 100644
--- a/wear/src/main/kotlin/app/aaps/wear/watchfaces/utils/WatchfaceViewAdapter.kt
+++ b/wear/src/main/kotlin/app/aaps/wear/watchfaces/utils/WatchfaceViewAdapter.kt
@@ -2,14 +2,12 @@ package app.aaps.wear.watchfaces.utils
import androidx.viewbinding.ViewBinding
import app.aaps.wear.databinding.ActivityBigchartBinding
-import app.aaps.wear.databinding.ActivityCockpitBinding
import app.aaps.wear.databinding.ActivityCustomBinding
import app.aaps.wear.databinding.ActivityDigitalstyleBinding
import app.aaps.wear.databinding.ActivityHome2Binding
import app.aaps.wear.databinding.ActivityHomeBinding
import app.aaps.wear.databinding.ActivityHomeLargeBinding
import app.aaps.wear.databinding.ActivityNochartBinding
-import app.aaps.wear.databinding.ActivitySteampunkBinding
/**
* WatchfaceViewAdapter binds all WatchFace variants shared attributes to one common view adapter.
@@ -20,15 +18,13 @@ class WatchfaceViewAdapter(
a2: ActivityHome2Binding? = null,
aa: ActivityHomeBinding? = null,
bC: ActivityBigchartBinding? = null,
- cp: ActivityCockpitBinding? = null,
ds: ActivityDigitalstyleBinding? = null,
nC: ActivityNochartBinding? = null,
- sP: ActivitySteampunkBinding? = null,
cU: ActivityCustomBinding? = null
) {
init {
- if (aL == null && a2 == null && aa == null && bC == null && cp == null && ds == null && nC == null && sP == null && cU == null) {
+ if (aL == null && a2 == null && aa == null && bC == null && ds == null && nC == null && cU == null) {
throw IllegalArgumentException("Require at least on Binding parameter")
}
}
@@ -37,52 +33,48 @@ class WatchfaceViewAdapter(
// Required attributes
val mainLayout =
- aL?.mainLayout ?: a2?.mainLayout ?: aa?.mainLayout ?: bC?.mainLayout ?: bC?.mainLayout ?: cp?.mainLayout ?: ds?.mainLayout ?: nC?.mainLayout ?: sP?.mainLayout ?: cU?.mainLayout
+ aL?.mainLayout ?: a2?.mainLayout ?: aa?.mainLayout ?: bC?.mainLayout ?: bC?.mainLayout ?: ds?.mainLayout ?: nC?.mainLayout ?: cU?.mainLayout
?: throw IllegalArgumentException(errorMessage)
val timestamp =
- aL?.timestamp ?: a2?.timestamp ?: aa?.timestamp ?: bC?.timestamp ?: bC?.timestamp ?: cp?.timestamp ?: ds?.timestamp ?: nC?.timestamp ?: sP?.timestamp ?: cU?.timestamp
+ aL?.timestamp ?: a2?.timestamp ?: aa?.timestamp ?: bC?.timestamp ?: bC?.timestamp ?: ds?.timestamp ?: nC?.timestamp ?: cU?.timestamp
?: throw IllegalArgumentException(errorMessage)
val root =
- aL?.root ?: a2?.root ?: aa?.root ?: bC?.root ?: bC?.root ?: cp?.root ?: ds?.root ?: nC?.root ?: sP?.root ?: cU?.root
+ aL?.root ?: a2?.root ?: aa?.root ?: bC?.root ?: bC?.root ?: ds?.root ?: nC?.root ?: cU?.root
?: throw IllegalArgumentException(errorMessage)
// Optional attributes
- val sgv = aL?.sgv ?: a2?.sgv ?: aa?.sgv ?: bC?.sgv ?: bC?.sgv ?: cp?.sgv ?: ds?.sgv ?: nC?.sgv ?: cU?.sgv
- val direction = aL?.direction ?: a2?.direction ?: aa?.direction ?: cp?.direction ?: ds?.direction
- val loop = a2?.loop ?: cp?.loop ?: sP?.loop ?: cU?.loop
- val delta = aL?.delta ?: a2?.delta ?: aa?.delta ?: bC?.delta ?: bC?.delta ?: cp?.delta ?: ds?.delta ?: nC?.delta ?: cU?.delta
- val avgDelta = a2?.avgDelta ?: bC?.avgDelta ?: bC?.avgDelta ?: cp?.avgDelta ?: ds?.avgDelta ?: nC?.avgDelta ?: cU?.avgDelta
- val uploaderBattery = aL?.uploaderBattery ?: a2?.uploaderBattery ?: aa?.uploaderBattery ?: cp?.uploaderBattery ?: ds?.uploaderBattery ?: sP?.uploaderBattery ?: cU?.uploaderBattery
- val rigBattery = a2?.rigBattery ?: cp?.rigBattery ?: ds?.rigBattery ?: sP?.rigBattery ?: cU?.rigBattery
- val basalRate = a2?.basalRate ?: cp?.basalRate ?: ds?.basalRate ?: sP?.basalRate ?: cU?.basalRate
+ val sgv = aL?.sgv ?: a2?.sgv ?: aa?.sgv ?: bC?.sgv ?: bC?.sgv ?: ds?.sgv ?: nC?.sgv ?: cU?.sgv
+ val direction = aL?.direction ?: a2?.direction ?: aa?.direction ?: ds?.direction
+ val loop = a2?.loop ?: cU?.loop
+ val delta = aL?.delta ?: a2?.delta ?: aa?.delta ?: bC?.delta ?: bC?.delta ?: ds?.delta ?: nC?.delta ?: cU?.delta
+ val avgDelta = a2?.avgDelta ?: bC?.avgDelta ?: bC?.avgDelta ?: ds?.avgDelta ?: nC?.avgDelta ?: cU?.avgDelta
+ val uploaderBattery = aL?.uploaderBattery ?: a2?.uploaderBattery ?: aa?.uploaderBattery ?: ds?.uploaderBattery ?: cU?.uploaderBattery
+ val rigBattery = a2?.rigBattery ?: ds?.rigBattery ?: cU?.rigBattery
+ val basalRate = a2?.basalRate ?: ds?.basalRate ?: cU?.basalRate
val bgi = a2?.bgi ?: ds?.bgi ?: cU?.bgi
- val AAPSv2 = a2?.AAPSv2 ?: cp?.AAPSv2 ?: ds?.AAPSv2 ?: sP?.AAPSv2 ?: cU?.AAPSv2
+ val AAPSv2 = a2?.AAPSv2 ?: ds?.AAPSv2 ?: cU?.AAPSv2
val cob1 = a2?.cob1 ?: ds?.cob1 ?: cU?.cob1
- val cob2 = a2?.cob2 ?: cp?.cob2 ?: ds?.cob2 ?: sP?.cob2 ?: cU?.cob2
- val time = aL?.time ?: a2?.time ?: aa?.time ?: bC?.time ?: bC?.time ?: cp?.time ?: nC?.time ?: cU?.time
+ val cob2 = a2?.cob2 ?: ds?.cob2 ?: cU?.cob2
+ val time = aL?.time ?: a2?.time ?: aa?.time ?: bC?.time ?: bC?.time ?: nC?.time ?: cU?.time
val second = cU?.second
val minute = ds?.minute ?: cU?.minute
val hour = ds?.hour ?: cU?.hour
val day = a2?.day ?: ds?.day ?: cU?.day
val month = a2?.month ?: ds?.month ?: cU?.month
val iob1 = a2?.iob1 ?: ds?.iob1 ?: cU?.iob1
- val iob2 = a2?.iob2 ?: cp?.iob2 ?: ds?.iob2 ?: sP?.iob2 ?: cU?.iob2
- val chart = a2?.chart ?: aa?.chart ?: bC?.chart ?: bC?.chart ?: ds?.chart ?: sP?.chart ?: cU?.chart
+ val iob2 = a2?.iob2 ?: ds?.iob2 ?: cU?.iob2
+ val chart = a2?.chart ?: aa?.chart ?: bC?.chart ?: bC?.chart ?: ds?.chart ?: cU?.chart
val status = aL?.status ?: aa?.status ?: bC?.status ?: bC?.status ?: nC?.status
val timePeriod = ds?.timePeriod ?: aL?.timePeriod ?: nC?.timePeriod ?: bC?.timePeriod ?: cU?.timePeriod
val dayName = ds?.dayName ?: cU?.dayName
- val mainMenuTap = ds?.mainMenuTap ?: sP?.mainMenuTap
- val chartZoomTap = ds?.chartZoomTap ?: sP?.chartZoomTap
+ val mainMenuTap = ds?.mainMenuTap
+ val chartZoomTap = ds?.chartZoomTap
val dateTime = ds?.dateTime ?: a2?.dateTime
val weekNumber = ds?.weekNumber ?: cU?.weekNumber
- // val minuteHand = sP?.minuteHand
- // val secondaryLayout = aL?.secondaryLayout ?: a2?.secondaryLayout ?: aa?.secondaryLayout ?: ds?.secondaryLayout ?: sP?.secondaryLayout
- // val tertiaryLayout = a2?.tertiaryLayout ?: sP?.tertiaryLayout
- // val highLight = cp?.highLight
- // val lowLight = cp?.lowLight
- // val deltaGauge = sP?.deltaPointer
- // val hourHand = sP?.hourHand
- // val glucoseDial = sP?.glucoseDial
+ // val minuteHand = cU?.minuteHand
+ // val secondaryLayout = aL?.secondaryLayout ?: a2?.secondaryLayout ?: aa?.secondaryLayout ?: ds?.secondaryLayout
+ // val tertiaryLayout = a2?.tertiaryLayout
+ // val hourHand = cU?.hourHand
companion object {
@@ -92,11 +84,9 @@ class WatchfaceViewAdapter(
is ActivityHome2Binding -> WatchfaceViewAdapter(null, bindLayout)
is ActivityHomeBinding -> WatchfaceViewAdapter(null, null, bindLayout)
is ActivityBigchartBinding -> WatchfaceViewAdapter(null, null, null, bindLayout)
- is ActivityCockpitBinding -> WatchfaceViewAdapter(null, null, null, null, bindLayout)
- is ActivityDigitalstyleBinding -> WatchfaceViewAdapter(null, null, null, null, null, bindLayout)
- is ActivityNochartBinding -> WatchfaceViewAdapter(null, null, null, null, null, null, bindLayout)
- is ActivitySteampunkBinding -> WatchfaceViewAdapter(null, null, null, null, null, null, null, bindLayout)
- is ActivityCustomBinding -> WatchfaceViewAdapter(null, null, null, null, null, null, null, null, bindLayout)
+ is ActivityDigitalstyleBinding -> WatchfaceViewAdapter(null, null, null, null, bindLayout)
+ is ActivityNochartBinding -> WatchfaceViewAdapter(null, null, null, null, null, bindLayout)
+ is ActivityCustomBinding -> WatchfaceViewAdapter(null, null, null, null, null, null, bindLayout)
else -> throw IllegalArgumentException("ViewBinding is not implement in WatchfaceViewAdapter")
}
}
diff --git a/wear/src/main/res/drawable/airplane_cockpit.png b/wear/src/main/res/drawable/airplane_cockpit.png
deleted file mode 100644
index 84da13abc7..0000000000
Binary files a/wear/src/main/res/drawable/airplane_cockpit.png and /dev/null differ
diff --git a/wear/src/main/res/drawable/airplane_cockpit_outside_clouds.png b/wear/src/main/res/drawable/airplane_cockpit_outside_clouds.png
deleted file mode 100644
index dca7e49079..0000000000
Binary files a/wear/src/main/res/drawable/airplane_cockpit_outside_clouds.png and /dev/null differ
diff --git a/wear/src/main/res/drawable/airplane_cockpit_outside_clouds_lowres.png b/wear/src/main/res/drawable/airplane_cockpit_outside_clouds_lowres.png
deleted file mode 100644
index e264408816..0000000000
Binary files a/wear/src/main/res/drawable/airplane_cockpit_outside_clouds_lowres.png and /dev/null differ
diff --git a/wear/src/main/res/drawable/airplane_led_grey_unlit.png b/wear/src/main/res/drawable/airplane_led_grey_unlit.png
deleted file mode 100644
index 614510d717..0000000000
Binary files a/wear/src/main/res/drawable/airplane_led_grey_unlit.png and /dev/null differ
diff --git a/wear/src/main/res/drawable/airplane_led_red_lit.png b/wear/src/main/res/drawable/airplane_led_red_lit.png
deleted file mode 100644
index 9f4d98073d..0000000000
Binary files a/wear/src/main/res/drawable/airplane_led_red_lit.png and /dev/null differ
diff --git a/wear/src/main/res/drawable/airplane_led_yellow_lit.png b/wear/src/main/res/drawable/airplane_led_yellow_lit.png
deleted file mode 100644
index cca76f6b2a..0000000000
Binary files a/wear/src/main/res/drawable/airplane_led_yellow_lit.png and /dev/null differ
diff --git a/wear/src/main/res/drawable/steampunk_cover_plate.png b/wear/src/main/res/drawable/steampunk_cover_plate.png
deleted file mode 100644
index f6d6c0c961..0000000000
Binary files a/wear/src/main/res/drawable/steampunk_cover_plate.png and /dev/null differ
diff --git a/wear/src/main/res/drawable/steampunk_dial_mgdl.png b/wear/src/main/res/drawable/steampunk_dial_mgdl.png
deleted file mode 100644
index e6315b1746..0000000000
Binary files a/wear/src/main/res/drawable/steampunk_dial_mgdl.png and /dev/null differ
diff --git a/wear/src/main/res/drawable/steampunk_dial_mmol.png b/wear/src/main/res/drawable/steampunk_dial_mmol.png
deleted file mode 100644
index 17325212c3..0000000000
Binary files a/wear/src/main/res/drawable/steampunk_dial_mmol.png and /dev/null differ
diff --git a/wear/src/main/res/drawable/steampunk_gauge_mgdl_10.png b/wear/src/main/res/drawable/steampunk_gauge_mgdl_10.png
deleted file mode 100644
index 6d268bebd7..0000000000
Binary files a/wear/src/main/res/drawable/steampunk_gauge_mgdl_10.png and /dev/null differ
diff --git a/wear/src/main/res/drawable/steampunk_gauge_mgdl_20.png b/wear/src/main/res/drawable/steampunk_gauge_mgdl_20.png
deleted file mode 100644
index a509d7b308..0000000000
Binary files a/wear/src/main/res/drawable/steampunk_gauge_mgdl_20.png and /dev/null differ
diff --git a/wear/src/main/res/drawable/steampunk_gauge_mgdl_5.png b/wear/src/main/res/drawable/steampunk_gauge_mgdl_5.png
deleted file mode 100644
index 9288c4e5ab..0000000000
Binary files a/wear/src/main/res/drawable/steampunk_gauge_mgdl_5.png and /dev/null differ
diff --git a/wear/src/main/res/drawable/steampunk_gauge_mmol_03.png b/wear/src/main/res/drawable/steampunk_gauge_mmol_03.png
deleted file mode 100644
index 18b8d0bf4e..0000000000
Binary files a/wear/src/main/res/drawable/steampunk_gauge_mmol_03.png and /dev/null differ
diff --git a/wear/src/main/res/drawable/steampunk_gauge_mmol_05.png b/wear/src/main/res/drawable/steampunk_gauge_mmol_05.png
deleted file mode 100644
index 07a48e8aac..0000000000
Binary files a/wear/src/main/res/drawable/steampunk_gauge_mmol_05.png and /dev/null differ
diff --git a/wear/src/main/res/drawable/steampunk_gauge_mmol_10.png b/wear/src/main/res/drawable/steampunk_gauge_mmol_10.png
deleted file mode 100644
index 55f5e59b5b..0000000000
Binary files a/wear/src/main/res/drawable/steampunk_gauge_mmol_10.png and /dev/null differ
diff --git a/wear/src/main/res/drawable/steampunk_hour_hand.png b/wear/src/main/res/drawable/steampunk_hour_hand.png
deleted file mode 100644
index f0031095d8..0000000000
Binary files a/wear/src/main/res/drawable/steampunk_hour_hand.png and /dev/null differ
diff --git a/wear/src/main/res/drawable/steampunk_minute_hand.png b/wear/src/main/res/drawable/steampunk_minute_hand.png
deleted file mode 100644
index 8b703d1b21..0000000000
Binary files a/wear/src/main/res/drawable/steampunk_minute_hand.png and /dev/null differ
diff --git a/wear/src/main/res/drawable/steampunk_pointer.png b/wear/src/main/res/drawable/steampunk_pointer.png
deleted file mode 100644
index 60792cd48a..0000000000
Binary files a/wear/src/main/res/drawable/steampunk_pointer.png and /dev/null differ
diff --git a/wear/src/main/res/drawable/watchface_cockpit.png b/wear/src/main/res/drawable/watchface_cockpit.png
deleted file mode 100644
index 88f7bb70a3..0000000000
Binary files a/wear/src/main/res/drawable/watchface_cockpit.png and /dev/null differ
diff --git a/wear/src/main/res/drawable/watchface_steampunk.png b/wear/src/main/res/drawable/watchface_steampunk.png
deleted file mode 100644
index 0db24e5faa..0000000000
Binary files a/wear/src/main/res/drawable/watchface_steampunk.png and /dev/null differ
diff --git a/wear/src/main/res/layout/activity_cockpit.xml b/wear/src/main/res/layout/activity_cockpit.xml
deleted file mode 100644
index a9f148c673..0000000000
--- a/wear/src/main/res/layout/activity_cockpit.xml
+++ /dev/null
@@ -1,444 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/wear/src/main/res/layout/activity_steampunk.xml b/wear/src/main/res/layout/activity_steampunk.xml
deleted file mode 100644
index df28e95d6f..0000000000
--- a/wear/src/main/res/layout/activity_steampunk.xml
+++ /dev/null
@@ -1,379 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/wear/src/main/res/values-bg-rBG/strings.xml b/wear/src/main/res/values-bg-rBG/strings.xml
index 2f2e4b0ebb..eeca18334c 100644
--- a/wear/src/main/res/values-bg-rBG/strings.xml
+++ b/wear/src/main/res/values-bg-rBG/strings.xml
@@ -8,8 +8,6 @@
AAPS(без Графика)
AAPS(Кръгъл)
AAPS(v2)
- AAPS(Самолет)
- AAPS(Steampunk)
AAPS (DigitalStyle)
AAPS(Персонализиран)
AAPS(Действия)
@@ -53,7 +51,6 @@
Десничар
Левичар
Модерен
- Делта грануларност (Steampunk)
Ниска
Средна
Висока
@@ -176,8 +173,6 @@
Няма налични данни
Нарастване
Намаляване
- В
- Н
средно
--Е
--гр
diff --git a/wear/src/main/res/values-ca-rES/strings.xml b/wear/src/main/res/values-ca-rES/strings.xml
index 85a00336f7..bfe951dbce 100644
--- a/wear/src/main/res/values-ca-rES/strings.xml
+++ b/wear/src/main/res/values-ca-rES/strings.xml
@@ -7,8 +7,6 @@
AAPS(GrafGrossa)
AAPS(NoGraf)
AAPS(Cercle)
- AAPS(Cockpit)
- AAPS(Steampunk)
AAPS(DigitalStyle)
Cap dada!
Dades antigues!
@@ -44,7 +42,6 @@
Ràpid dreta
Ràpid esquerra
Dispers modern
- Granularitat delta (Steampunk)
Baix
Mig
Alt
diff --git a/wear/src/main/res/values-cs-rCZ/strings.xml b/wear/src/main/res/values-cs-rCZ/strings.xml
index d2103d8074..ff0f4e4dfb 100644
--- a/wear/src/main/res/values-cs-rCZ/strings.xml
+++ b/wear/src/main/res/values-cs-rCZ/strings.xml
@@ -8,8 +8,6 @@
AAPS(BezGrafu)
AAPS(Kruhový)
AAPS(v2)
- AAPS(Kokpit)
- AAPS (Steampunk)
AAPS (DigitalStyle)
AAPS (vlastní)
AAPS(Akce)
@@ -62,7 +60,6 @@
Rychle zprava
Rychle zleva
Modern Sparse
- Míra podrobnosti delty (Steampunk)
Nízká
Střední
Vysoká
@@ -185,8 +182,6 @@
Žádná data k dispozici
zvýšení
snížení
- V
- N
prům
--U
--g
diff --git a/wear/src/main/res/values-da-rDK/strings.xml b/wear/src/main/res/values-da-rDK/strings.xml
index 8b1d49d32e..3dc905dda5 100644
--- a/wear/src/main/res/values-da-rDK/strings.xml
+++ b/wear/src/main/res/values-da-rDK/strings.xml
@@ -8,8 +8,6 @@
AAPS(IngenGraf)
AAPS(Cirkel)
AAPS(v2)
- AAPS(Cockpit)
- AAPS(Steampunk)
AAPS (DigitalStil)
AAPS(Brugerdefineret)
AAPS (Handlinger)
@@ -60,7 +58,6 @@
Hurtigt højre
Hurtig venstre
Moderne spreder
- Delta Granularitet (Steampunk)
Lav
Medium
Høj
@@ -183,8 +180,6 @@
Ingen data tilgængelig
forøgelse
formindskelse
- H
- L
gns.
--IE
--g
diff --git a/wear/src/main/res/values-de-rDE/strings.xml b/wear/src/main/res/values-de-rDE/strings.xml
index 3e71e6e871..ea613f1c35 100644
--- a/wear/src/main/res/values-de-rDE/strings.xml
+++ b/wear/src/main/res/values-de-rDE/strings.xml
@@ -8,8 +8,6 @@
AAPS(KeinGraph)
AAPS(Kreis)
AAPS(v2)
- AAPS(Cockpit)
- AAPS(Steampunk)
AAPS(DigitalStyle)
AAPS(Custom)
AAPS(Aktionen)
@@ -53,7 +51,6 @@
Schnell rechts
Schnell links
Modern Sparse
- Genauigkeit (Steampunk)
Niedrig
Mittel
Hoch
@@ -176,8 +173,6 @@
Keine Daten vorhanden
erhöhen
verringern
- H
- L
Ø
--IE
--g
diff --git a/wear/src/main/res/values-el-rGR/strings.xml b/wear/src/main/res/values-el-rGR/strings.xml
index 95bc53a56d..52efac981f 100644
--- a/wear/src/main/res/values-el-rGR/strings.xml
+++ b/wear/src/main/res/values-el-rGR/strings.xml
@@ -8,8 +8,6 @@
AAPS(χωρίς_γράφημα)
AAPS(Κυκλικό)
AAPS(v2)
- AAPS(Πιλοτήριο)
- AAPS(Steampunk)
AAPS(ψηφιακό)
AAPS(προσαρμοσμένα_χαρακτηριστικά)
AAPS( Ενέργειες)
@@ -59,7 +57,6 @@
Γρήγορα δεξιά
Γρήγορα αριστερά
Σύγχρονο Sparse
- Διαφορά Βαθμού Λεπτομέρειας (Steampunk)
Χαμηλή
Μέσο
Υψηλό
@@ -182,8 +179,6 @@
Δεν υπάρχουν διαθέσιμα δεδομένα
αύξηση
μείωση
- H
- L
μέσος
--U
--g
diff --git a/wear/src/main/res/values-es-rES/strings.xml b/wear/src/main/res/values-es-rES/strings.xml
index 16d9723927..d7dd4c9ac3 100644
--- a/wear/src/main/res/values-es-rES/strings.xml
+++ b/wear/src/main/res/values-es-rES/strings.xml
@@ -8,8 +8,6 @@
AAPS (SinGráfico)
AAPS (Círculo)
AAPS(v2)
- AAPS(Cockpit)
- AAPS(Steampunk)
AAPS (Digital)
AAPS(personalizado)
AAPS(Acciones)
@@ -62,7 +60,6 @@
Rápido a la derecha
Rápido a la izquierda
Disperso moderno
- Granularidad delta (Steampunk)
Bajo
Medio
Alto
@@ -185,8 +182,6 @@
No hay datos disponibles
incremento
decremento
- A
- B
media
--U
--g
diff --git a/wear/src/main/res/values-fr-rFR/strings.xml b/wear/src/main/res/values-fr-rFR/strings.xml
index a06d81f46a..3c0669aac0 100644
--- a/wear/src/main/res/values-fr-rFR/strings.xml
+++ b/wear/src/main/res/values-fr-rFR/strings.xml
@@ -8,8 +8,6 @@
AAPS (SansGraph)
AAPS (Cercle)
AAPS (v2)
- AAPS (Cockpit)
- AAPS (Steampunk)
AAPS (Digital)
AAPS(perso)
AAPS (Actions)
@@ -62,7 +60,6 @@
Droitier
Gaucher
Moderne
- Précision Delta (Steampunk)
Faible
Moyen
Élevé
@@ -185,8 +182,6 @@
Aucune donnée disponible
augmenter
diminuer
- H
- B
moy
--U
--g
diff --git a/wear/src/main/res/values-hr-rHR/strings.xml b/wear/src/main/res/values-hr-rHR/strings.xml
index 7cbbee1c5a..9d657e0902 100644
--- a/wear/src/main/res/values-hr-rHR/strings.xml
+++ b/wear/src/main/res/values-hr-rHR/strings.xml
@@ -8,7 +8,6 @@
AAPS(Bez grafa)
AAPS(Kružni)
AAPS(v2)
- AAPS(Cockpit)
Nisko
Visoko
Kalkulator
@@ -31,8 +30,6 @@
Otkaži
povećanje
smanjenje
- H
- L
prosječno
U
--g
diff --git a/wear/src/main/res/values-hu-rHU/strings.xml b/wear/src/main/res/values-hu-rHU/strings.xml
index 20664f080f..42b5f8da0f 100644
--- a/wear/src/main/res/values-hu-rHU/strings.xml
+++ b/wear/src/main/res/values-hu-rHU/strings.xml
@@ -7,8 +7,6 @@
AAPS(NagyGrafikon)
AAPS(NincsGrafikon)
AAPS(Kör)
- AAPS(Pilótafülke)
- AAPS(Steampunk)
AAPS(Digitális)
Nincs adat!
Régi adat!
diff --git a/wear/src/main/res/values-it-rIT/strings.xml b/wear/src/main/res/values-it-rIT/strings.xml
index 61a9158f1f..bd62bf02ab 100644
--- a/wear/src/main/res/values-it-rIT/strings.xml
+++ b/wear/src/main/res/values-it-rIT/strings.xml
@@ -8,8 +8,6 @@
AAPS(NoChart)
AAPS(Circle)
AAPS(v2)
- AAPS(Cockpit)
- AAPS(Steampunk)
AAPS(DigitalStyle)
AAPS(Personalizzato)
AAPS(azioni)
@@ -59,7 +57,6 @@
Quick righty
Quick lefty
Modern Sparse
- Delta Granularity (Steampunk)
Basso
Medio
Alto
@@ -182,8 +179,6 @@
Nessun dato disponibile
incremento
decremento
- H
- L
media
--U
--g
diff --git a/wear/src/main/res/values-iw-rIL/strings.xml b/wear/src/main/res/values-iw-rIL/strings.xml
index bc4359285f..f967777df3 100644
--- a/wear/src/main/res/values-iw-rIL/strings.xml
+++ b/wear/src/main/res/values-iw-rIL/strings.xml
@@ -8,8 +8,6 @@
AAPS (ללא תרשים)
AAPS (עיגול)
AAPS (v2)
- AAPS (תא טייס)
- AAPS (סטימפאנק)
AAPS (דיגיטלי)
AAPS (פעולות)
AAPS (מטרה זמנית)
@@ -54,7 +52,6 @@
ימני מהיר
שמאלי מהיר
מינימלי מודרני
- מפורט (סטימפאנק)
נמוך
בינוני
גבוה
@@ -176,8 +173,6 @@
אין נתונים זמינים
תוספת
הפחתה
- גב\'
- נמ\'
ממוצע
-- יח\'
-- גר\'
diff --git a/wear/src/main/res/values-ko-rKR/strings.xml b/wear/src/main/res/values-ko-rKR/strings.xml
index e0268f71a5..fd4d545f9e 100644
--- a/wear/src/main/res/values-ko-rKR/strings.xml
+++ b/wear/src/main/res/values-ko-rKR/strings.xml
@@ -8,8 +8,6 @@
AAPS(차트없음)
AAPS(원형)
AAPS(v2)
- AAPS(조종석)
- AAPS(스팀펑크)
AAPS(디지털방식)
AAPS(Custom)
AAPS(Actions)
@@ -53,7 +51,6 @@
오른손잡이
왼손잡이
모던스타일
- 증분 밀도(스팀펑크)
저
중
고
@@ -176,8 +173,6 @@
사용할 수 있는 데이터 없음
증가
감소
- H
- L
평균
--U
--g
diff --git a/wear/src/main/res/values-lt-rLT/strings.xml b/wear/src/main/res/values-lt-rLT/strings.xml
index 54727ea9ae..4fe153c042 100644
--- a/wear/src/main/res/values-lt-rLT/strings.xml
+++ b/wear/src/main/res/values-lt-rLT/strings.xml
@@ -8,8 +8,6 @@
AAPS(BeGrafiko)
AAPS(Apvalus)
AAPS(v2)
- AAPS(Cockpit)
- AAPS(Steampunk)
AAPS(DigitalStyle)
AAPS(suasmeninta)
AAPS(Veiksmai)
@@ -44,6 +42,9 @@
Rodyti GĮ
Rodyti krypties rodyklę
Laikas nuo pask. vertės
+ Rodyti LB
+ Rodyti bolusus & SMB
+ Rodyti tinklelį
Tamsus
Paryškinti valandines bazes
Rodyti prognozes
@@ -59,7 +60,6 @@
Greitai dešinėn
Greitai kairėn
Minimalistinis
- Detalus pokytis (Steampunk)
Žemas
Vidutinis
Aukštas
@@ -182,8 +182,6 @@
Nėra duomenų
didėjimas
mažėjimas
- H
- L
vid.
--v
--g
diff --git a/wear/src/main/res/values-no-rNO/strings.xml b/wear/src/main/res/values-nb-rNO/strings.xml
similarity index 95%
rename from wear/src/main/res/values-no-rNO/strings.xml
rename to wear/src/main/res/values-nb-rNO/strings.xml
index 0a02924700..426e56cc75 100644
--- a/wear/src/main/res/values-no-rNO/strings.xml
+++ b/wear/src/main/res/values-nb-rNO/strings.xml
@@ -8,13 +8,11 @@
AAPS (ingen graf)
AAPS (sirkel)
AAPS(v2)
- AAPS(Cockpit)
- AAPS(Steampunk)
AAPS(Digitalstil)
AAPS(Tilpasset)
AAPS(Actions)
AAPS(Midl. Mål)
- AAPS(Quick Wizard)
+ AAPS(Hurtigknapp)
Ingen data!
Gamle data!
Siden %1$s
@@ -62,7 +60,6 @@
Raskt høyre
Raskt venstre
Modern Sparse
- Deltagranularitet (Steampunk)
Lav
Middels
Høy
@@ -80,7 +77,7 @@
Versjon:
Flere innstillinger for urskive
Vennligst sjekk urskiveinnstillinger.
- MidlMål
+ Midl. mål
Kalkulator
Kalk
Behandling
@@ -98,7 +95,7 @@
XL
Varighet
Midl. mål forespurt
- Quick Wizard forespurt
+ Hurtigknapp forespurt
Behandling forespurt
Bolus forespurt
Beregning forespurt
@@ -119,7 +116,7 @@
Forhåndsinnstilling 3
Valgfri mengde
BEKREFT
- tidsforskyving
+ tidsforskyv
Bolus
Bolus fremdrift
trykk for å avbryte
@@ -174,7 +171,7 @@
Under lading
Alltid På modus
Alltid på under lading
- Spising
+ Spise snart
Hypo
Aktivitet
Manuell
@@ -185,8 +182,6 @@
Ingen data tilgjengelig
økning
reduksjon
- H
- L
snitt
--E
--g
diff --git a/wear/src/main/res/values-nl-rNL/strings.xml b/wear/src/main/res/values-nl-rNL/strings.xml
index 6ae34ecb6d..704466c59a 100644
--- a/wear/src/main/res/values-nl-rNL/strings.xml
+++ b/wear/src/main/res/values-nl-rNL/strings.xml
@@ -8,8 +8,6 @@
AAPS(GeenGrafiek)
AAPS(Cirkel)
AAPS(v2)
- AAPS(Cockpit)
- AAPS(Steampunk)
AAPS(DigitaleStijl)
AAPS(Custom)
AAPS(Acties)
@@ -62,7 +60,6 @@
Snel rechts
Snel links
Modern spaarzaam
- Delta schaalverdeling (Steampunk)
Laag
Middel
Hoog
@@ -185,8 +182,6 @@
Geen data beschikbaar
verhoog
verlaag
- H
- L
gem
--E
--g
diff --git a/wear/src/main/res/values-pl-rPL/strings.xml b/wear/src/main/res/values-pl-rPL/strings.xml
index a66313e1cf..2eb5cd5f3b 100644
--- a/wear/src/main/res/values-pl-rPL/strings.xml
+++ b/wear/src/main/res/values-pl-rPL/strings.xml
@@ -8,8 +8,6 @@
AAPS(BezWykresu)
AAPS(Koło)
AAPS(v2)
- AAPS(Kokpit)
- AAPS(Steampunk)
AAPS(StylCyfrowy)
AAPS(niestandardowy)
AAPS(Ustawienia)
@@ -62,7 +60,6 @@
Szybki prawy
Szybki lewy
Minimalistyczny
- Granularność Delty (Steampunk)
Niska
Średnia
Wysoka
@@ -185,8 +182,6 @@
Brak dostępnych danych
zwiększenie
zmniejszenie
- W
- N
śr
--U
--g
diff --git a/wear/src/main/res/values-pt-rBR/strings.xml b/wear/src/main/res/values-pt-rBR/strings.xml
index 672219eec4..a30c53b003 100644
--- a/wear/src/main/res/values-pt-rBR/strings.xml
+++ b/wear/src/main/res/values-pt-rBR/strings.xml
@@ -8,8 +8,6 @@
AAPS(SemGraf)
AAPS(Círculo)
AAPS(v2)
- AAPS(Cockpit)
- AAPS(Steampunk)
AAPS(DigitalStyle)
AAPS(Ações)
AAPS(Meta Temporária)
@@ -48,7 +46,6 @@
Rápido Direito
Rápido Esquerdo
Moderno Esparso
- Delta Granularidade (Steampunk)
Baixo
Médio
Alto
@@ -170,8 +167,6 @@
Sem dados disponíveis
incremento
diminuição
- H
- L
média
--U
--g
diff --git a/wear/src/main/res/values-pt-rPT/strings.xml b/wear/src/main/res/values-pt-rPT/strings.xml
index 469c1dc139..41bc5307b5 100644
--- a/wear/src/main/res/values-pt-rPT/strings.xml
+++ b/wear/src/main/res/values-pt-rPT/strings.xml
@@ -8,8 +8,6 @@
AAPS(SemGraf)
AAPS(Círculo)
AAPS(v2)
- AAPS(Cockpit)
- AAPS(Steampunk)
AAPS(DigitalStyle)
AAPS(personalizado)
AAPS(Ações)
@@ -58,7 +56,6 @@
Rápido Direito
Rápido Esquerdo
Moderno Esparso
- Delta Granularidade (Steampunk)
Baixo
Médio
Alto
@@ -181,8 +178,6 @@
Dados indisponíveis
aumentar
diminuir
- H
- L
média
--U
--g
diff --git a/wear/src/main/res/values-ro-rRO/strings.xml b/wear/src/main/res/values-ro-rRO/strings.xml
index 43e2c50004..0fd9642499 100644
--- a/wear/src/main/res/values-ro-rRO/strings.xml
+++ b/wear/src/main/res/values-ro-rRO/strings.xml
@@ -8,8 +8,6 @@
AAPS(FărăGrafic)
AAPS(Cerc)
AAPS(v2)
- AAPS(Panou)
- AAPS (Steampunk)
AAPS (DigitalStyle)
AAPS (Personalizat)
AAPS(Acțiuni)
@@ -62,7 +60,6 @@
Drepta rapid
Stânga rapid
Distanță modernă
- Granularitate Delta (Steampunk)
Mic
Mediu
Mare
@@ -185,8 +182,6 @@
Nu există date disponibile
creștere
scădere
- H
- L
med.
--U
--g
diff --git a/wear/src/main/res/values-ru-rRU/strings.xml b/wear/src/main/res/values-ru-rRU/strings.xml
index 00028b1cd3..b1adbce79f 100644
--- a/wear/src/main/res/values-ru-rRU/strings.xml
+++ b/wear/src/main/res/values-ru-rRU/strings.xml
@@ -8,8 +8,6 @@
AAPS (Без графика)
AAPS (круглый)
AAPS(v2)
- AAPS (кабина пилота)
- AAPS (Стимпанк)
AAPS (ЦифровойСтиль)
AAPS (настраиваемый)
AAPS (Действия)
@@ -44,6 +42,9 @@
Отображать ГКИ (BGI)
Показывать стрелку тренда
Показывать ретро события
+ Показывать ВБС
+ Показывать болюс & СМБ
+ Показывать сетку
Тёмная
Выделить базалы
Показывать прогноз
@@ -59,7 +60,6 @@
Быстрый правосторонний
Быстрый левосторонний
Современный разреженный
- Дельта детально (Стимпанк)
Низкий
Средний
Высокий
@@ -182,8 +182,6 @@
Нет данных
приращение
декремент
- В
- Н
сред
--ед
--г
diff --git a/wear/src/main/res/values-sk-rSK/strings.xml b/wear/src/main/res/values-sk-rSK/strings.xml
index 27a7110aad..86bdf56cb4 100644
--- a/wear/src/main/res/values-sk-rSK/strings.xml
+++ b/wear/src/main/res/values-sk-rSK/strings.xml
@@ -8,8 +8,6 @@
AAPS(ŽiadnyGraf)
AAPS(Kruhový)
AAPS(v2)
- AAPS(Kokpit)
- AAPS (Steampunk)
AAPS (DigitalStyle)
AAPS (vlastný)
AAPS (Akcie)
@@ -44,6 +42,9 @@
Zobraziť BGI
Zobrazovať trendovú šípku
Zobraziť aktualizované pred
+ Zobraziť dočasný bazál
+ Zobraziť Bolus & SMB
+ Zobraziť mriežku
Tmavý
Zvýrazniť bazály
Zobraziť predikcie
@@ -59,7 +60,6 @@
Rýchlo vpravo
Rýchlo vľavo
Modern Sparse
- Presnosť (Steampunk)
Nízka
Stredná
Vysoká
@@ -182,8 +182,6 @@
Žiadne údaje nie sú k dispozícii
prírastok
zníženie
- H
- L
priemer
--JI
--g
diff --git a/wear/src/main/res/values-sv-rSE/strings.xml b/wear/src/main/res/values-sv-rSE/strings.xml
index bcebeaa52f..022ee17421 100644
--- a/wear/src/main/res/values-sv-rSE/strings.xml
+++ b/wear/src/main/res/values-sv-rSE/strings.xml
@@ -8,8 +8,6 @@
AAPS (NoChart)
AAPS (Circle)
AAPS(v2)
- AAPS (Cockpit)
- AAPS (Steampunk)
AAPS (DigitalStyle)
AAPS (anpassad)
AAPS(Åtgärder)
@@ -53,7 +51,6 @@
Snabb höger
Snabb vänster
Modern Sparse
- Precision för skillnad (Steampunk)
Låg
Mellan
Hög
@@ -176,8 +173,6 @@
Ingen data tillgänglig
öka
minska
- H
- L
medel
--U
--g
diff --git a/wear/src/main/res/values-tr-rTR/strings.xml b/wear/src/main/res/values-tr-rTR/strings.xml
index 3e2be2dd4e..5e2e96c084 100644
--- a/wear/src/main/res/values-tr-rTR/strings.xml
+++ b/wear/src/main/res/values-tr-rTR/strings.xml
@@ -8,8 +8,6 @@
AAPS(GrafikYok)
AAPS(Daire)
AAPS (v2)
- AAPS(Cockpit)
- AAPS (Steampunk)
AAPS(DijitalStil)
AAPS(Özel)
AAPS(Eylemler)
@@ -62,7 +60,6 @@
Hızlı Sağ
Hızlı Sol
Modern Seyrek
- Delta Tanecikliliği (Steampunk)
Düşük
Orta
Yüksek
@@ -185,8 +182,6 @@
Veri yok
artış
azalma
- Y
- D
ort
--Ü
--g
diff --git a/wear/src/main/res/values-zh-rCN/strings.xml b/wear/src/main/res/values-zh-rCN/strings.xml
index 9c857fb1a9..1d8d4093ae 100644
--- a/wear/src/main/res/values-zh-rCN/strings.xml
+++ b/wear/src/main/res/values-zh-rCN/strings.xml
@@ -8,8 +8,6 @@
AAPS(无图)
AAPS(圆形)
AAPS(v2)
- AAPS(驾驶)
- AAPS(机械)
AAPS(数字风格)
AAPS(操作)
AAPS(临时目标)
@@ -48,7 +46,6 @@
快速右对齐
快速左对齐
现代场景
- 变化量详细程度 (Steampunk)
低
中等
高
diff --git a/wear/src/main/res/values/strings.xml b/wear/src/main/res/values/strings.xml
index 2b21dcbc16..6599af1430 100644
--- a/wear/src/main/res/values/strings.xml
+++ b/wear/src/main/res/values/strings.xml
@@ -8,8 +8,6 @@
AAPS(NoChart)
AAPS(Circle)
AAPS(v2)
- AAPS(Cockpit)
- AAPS(Steampunk)
AAPS(DigitalStyle)
AAPS(Custom)
AAPS(Actions)
@@ -62,7 +60,6 @@
Quick righty
Quick lefty
Modern Sparse
- Delta Granularity (Steampunk)
Low
Medium
High
@@ -243,8 +240,6 @@
lowcolor
increment
decrement
- H
- L
avg
--U
--g
diff --git a/wear/src/main/res/xml/watch_face_configuration_cockpit.xml b/wear/src/main/res/xml/watch_face_configuration_cockpit.xml
deleted file mode 100644
index c6a75d256e..0000000000
--- a/wear/src/main/res/xml/watch_face_configuration_cockpit.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/wear/src/main/res/xml/watch_face_configuration_steampunk.xml b/wear/src/main/res/xml/watch_face_configuration_steampunk.xml
deleted file mode 100644
index 08758b3f81..0000000000
--- a/wear/src/main/res/xml/watch_face_configuration_steampunk.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
-
-