summaryrefslogtreecommitdiff
path: root/source/util/TestMode.mc
diff options
context:
space:
mode:
authorcirakg <cirakg@cirakg.xyz>2026-10-19 22:28:09 +0200
committercirakg <cirakg@cirakg.xyz>2026-10-19 22:28:09 +0200
commit35042ff04ffc50e55ff59a385849442be4429d6b (patch)
tree3c142dd9bfb995b7aacdf39128e591dd3f9370de /source/util/TestMode.mc
parent871aba901501302586895d266fe4569665d9fe70 (diff)
feat(ui): add the list, OTP detail, PIN entry, menu, info screens and glance
List with live codes and countdowns, adaptive rows and lazy headers; OTP detail with ring or bar, next code and HOTP next; PIN keypad or button selector with create, unlock, change, lockout display and pending promotion; native menu; glance with the entry count; self-test after the first frame; option properties with defaults. Codes are computed one per timer event, apart from drawing, for the watchdog. A UI-test build (uitest.jungle) starts with fake entries, PIN 123456 and a frozen clock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'source/util/TestMode.mc')
-rw-r--r--source/util/TestMode.mc30
1 files changed, 30 insertions, 0 deletions
diff --git a/source/util/TestMode.mc b/source/util/TestMode.mc
new file mode 100644
index 0000000..9b5c36f
--- /dev/null
+++ b/source/util/TestMode.mc
@@ -0,0 +1,30 @@
+// Author: cirakg & claude ai
+// Summary: Switch for the UI-test build: a frozen clock, a short auto-lock and a store reset to fake entries.
+//
+// Two versions of this module exist; each build keeps exactly one:
+// * (:no_uitest), in every normal build (debug, release, unit tests):
+// ON is false and nothing changes.
+// * (:uitest), only with uitest.jungle (`make screenshots`): the clock is
+// frozen at NOW, so codes and countdowns in screenshots never change; the
+// store is wiped and filled with fake entries at every start
+// (source/app/Fixtures.mc); auto-lock is short enough to test.
+// The constant-condition checks on ON are resolved by the compiler, so the
+// unused branch costs nothing.
+
+import Toybox.Lang;
+
+(:uitest)
+module TestMode {
+ const ON = true;
+ // 2027-01-15 08:00:26 UTC: 4 s left in a 30 s period, so the detail
+ // screen shows the next code too.
+ const NOW = 1800000026l;
+ const AUTO_LOCK_MS = 10000;
+}
+
+(:no_uitest)
+module TestMode {
+ const ON = false;
+ const NOW = 0l;
+ const AUTO_LOCK_MS = 0;
+}