From 826497c9f6fbe07f4a548a8429813a361d671338 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 13 Mar 2019 18:50:37 +0100 Subject: [PATCH] Fix superbolus test & allow APS plugin to be constraint --- .../java/info/nightscout/androidaps/interfaces/PluginBase.java | 2 ++ .../androidaps/interfaces/ConstraintsCheckerTest.java | 1 + 2 files changed, 3 insertions(+) diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java b/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java index b92b8a8f87..01be296539 100644 --- a/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java +++ b/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java @@ -93,6 +93,8 @@ public abstract class PluginBase { return state == State.ENABLED && specialEnableCondition(); if (type == PluginType.CONSTRAINTS && pluginDescription.mainType == PluginType.PUMP && isEnabled(PluginType.PUMP)) return true; + if (type == PluginType.CONSTRAINTS && pluginDescription.mainType == PluginType.APS && isEnabled(PluginType.APS)) + return true; if (type == PluginType.PROFILE && pluginDescription.mainType == PluginType.PUMP) return isProfileInterfaceEnabled; return false; diff --git a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.java b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.java index d391d847f1..ee03ef73d7 100644 --- a/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.java +++ b/app/src/test/java/info/nightscout/androidaps/interfaces/ConstraintsCheckerTest.java @@ -122,6 +122,7 @@ public class ConstraintsCheckerTest { @Test public void isSuperBolusEnabledTest() throws Exception { + OpenAPSSMBPlugin.getPlugin().setPluginEnabled(PluginType.APS, true); Constraint c = constraintChecker.isSuperBolusEnabled(); Assert.assertEquals(Boolean.FALSE, c.value()); // SMB should limit