aboutsummaryrefslogtreecommitdiff
path: root/spike/settings/source/DebugSelfTest.mc
diff options
context:
space:
mode:
Diffstat (limited to 'spike/settings/source/DebugSelfTest.mc')
-rw-r--r--spike/settings/source/DebugSelfTest.mc35
1 files changed, 35 insertions, 0 deletions
diff --git a/spike/settings/source/DebugSelfTest.mc b/spike/settings/source/DebugSelfTest.mc
new file mode 100644
index 0000000..ef50148
--- /dev/null
+++ b/spike/settings/source/DebugSelfTest.mc
@@ -0,0 +1,35 @@
+// Author: cirakg & claude ai
+// Summary: Debug-only self-test: fills one field and runs the settings-change path once, so the simulator shows real output.
+//
+// The simulator has no phone, so this stands in for one save from Garmin
+// Connect: if Text 1 is empty it receives a fake 100-character test string,
+// then the normal onSettingsChanged path runs (analysis plus write-back).
+// It prints a "SPIKE ready" line that build-spike.sh waits for. Release
+// builds compile the empty (:release) version, so the beta you upload never
+// changes your settings by itself.
+
+import Toybox.Application.Properties;
+import Toybox.Lang;
+import Toybox.System;
+
+module DebugSelfTest {
+
+ // Fake 100-character test string in the same format as the phone tests.
+ (:debug)
+ const SAMPLE = "N=100|abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrP0050stuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghEND";
+
+ (:debug)
+ function run(app as SpikeApp) as Void {
+ var current = Properties.getValue("text1");
+ if (current == null || (current instanceof String && current.length() == 0)) {
+ Properties.setValue("text1", SAMPLE);
+ app.onSettingsChanged();
+ }
+ System.println("SPIKE ready total_chars=" + app.report.totalChars + " changes=" + app.report.changeCount
+ + " status='" + Properties.getValue("statusField") + "'");
+ }
+
+ (:release)
+ function run(app as SpikeApp) as Void {
+ }
+}