aboutsummaryrefslogtreecommitdiff
path: root/source/util/TestMode.mc
blob: 6439be12f629457c68cf545fe610e6da3f6682eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// 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.
//
// Three 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 in the UI-test builds (`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.
//     SCENARIO picks the fixture: SCENARIO_MAIN (uitest.jungle: the import,
//     the forms and the demo entries) or SCENARIO_EXTRA
//     (uitest-extra.jungle: a legacy PIN, a queued "Require PIN", more
//     symbologies and an invalid code), each in its own build, since a
//     launch can't pass arguments to the app.
// The constant-condition checks on ON are resolved by the compiler, so the
// unused branch costs nothing.

import Toybox.Lang;

(:uitest, :uitest_main, :glance)
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;
    const SCENARIO_MAIN = 0;
    const SCENARIO_EXTRA = 1;
    const SCENARIO = SCENARIO_MAIN;
}

(:uitest, :uitest_extra, :glance)
module TestMode {
    const ON = true;
    const NOW = 1800000026l;
    const AUTO_LOCK_MS = 10000;
    const SCENARIO_MAIN = 0;
    const SCENARIO_EXTRA = 1;
    const SCENARIO = SCENARIO_EXTRA;
}

(:no_uitest, :glance)
module TestMode {
    const ON = false;
    const NOW = 0l;
    const AUTO_LOCK_MS = 0;
    const SCENARIO_MAIN = 0;
    const SCENARIO_EXTRA = 1;
    const SCENARIO = SCENARIO_MAIN;
}