forked from Blendman974/faceclaw
Battery indicators and other places no longer say "G2" when a G1 or iO is paired
This commit is contained in:
1 parent
ac68ba5991
commit
e103b89510
21 files changed
+101
-46
No files matched your search
@@ -15,6 +15,7 @@ const connected = {
|
||||
silentMode: false,
|
||||
screenOn: true,
|
||||
battery: 72,
|
||||
glassesModel: "G2",
|
||||
caseBattery: null,
|
||||
caseCharging: null,
|
||||
foregroundTitle: "Music",
|
||||
@@ -37,22 +38,23 @@ test("only the Display off state counts as asleep (the watch face's wake hint)",
|
||||
assert.equal(glassesDisplayAsleep({ ...connected, phase: "disconnected", screenOn: false }), false);
|
||||
});
|
||||
|
||||
test("charging takes precedence and includes the last-known G2 battery", () => {
|
||||
test("charging takes precedence and includes the glasses' model and last-known battery", () => {
|
||||
assert.equal(
|
||||
glassesDisplayLabel({ ...connected, phase: "charging", silentMode: true, screenOn: false }),
|
||||
"Charging · G2 72%",
|
||||
"Charging: G2 72%",
|
||||
);
|
||||
assert.equal(chargingDisplayLabel(null), "Charging");
|
||||
assert.equal(chargingDisplayLabel(-1), "Charging");
|
||||
assert.equal(chargingDisplayLabel(101), "Charging");
|
||||
assert.equal(glassesDisplayLabel({ ...connected, phase: "charging", glassesModel: "G1" }), "Charging: G1 72%");
|
||||
assert.equal(chargingDisplayLabel(null, "G2"), "Charging");
|
||||
assert.equal(chargingDisplayLabel(-1, "G2"), "Charging");
|
||||
assert.equal(chargingDisplayLabel(101, "G2"), "Charging");
|
||||
});
|
||||
|
||||
test("while charging, the case level is the watch face's second line and joins the mirror's message", () => {
|
||||
const charging = { ...connected, phase: "charging", caseBattery: 64, caseCharging: false };
|
||||
assert.equal(glassesDisplayLabel(charging), "Charging · G2 72%");
|
||||
assert.equal(glassesDisplayLabel(charging), "Charging: G2 72%");
|
||||
assert.equal(glassesDisplayDetail(charging), "Case 64%");
|
||||
assert.equal(glassesDisplayDetail({ ...charging, caseCharging: true }), "Case 64% ⚡");
|
||||
assert.equal(chargingPreviewMessage(charging), "Charging · G2 72% · Case 64%");
|
||||
assert.equal(chargingPreviewMessage(charging), "Charging: G2 72% · Case 64%");
|
||||
// No case level yet: the label alone.
|
||||
assert.equal(glassesDisplayDetail({ ...charging, caseBattery: null }), "");
|
||||
assert.equal(chargingPreviewMessage({ ...charging, caseBattery: null, battery: null }), "Charging");
|
||||
@@ -65,14 +67,19 @@ const levels = {
|
||||
};
|
||||
|
||||
test("the Settings battery line lists each known level, with ⚡ only while the reading is live", () => {
|
||||
assert.equal(formatBatteryLine(levels, true), "G2 87% ⚡ · Case 64% ⚡ · R1 72%");
|
||||
assert.equal(formatBatteryLine(levels, true, "G2"), "G2 87% ⚡ · Case 64% ⚡ · R1 72%");
|
||||
// Without a link to the glasses their charging state and the case's are stale.
|
||||
assert.equal(formatBatteryLine({ ...levels, ringCharging: true }, false), "G2 87% · Case 64% · R1 72% ⚡");
|
||||
assert.equal(formatBatteryLine({ ...levels, ringCharging: true }, false, "G2"), "G2 87% · Case 64% · R1 72% ⚡");
|
||||
// caseCharging is null while the glasses are out of the case.
|
||||
assert.equal(formatBatteryLine({ ...levels, caseCharging: null }, true), "G2 87% ⚡ · Case 64% · R1 72%");
|
||||
assert.equal(formatBatteryLine({ ...levels, case: null, ring: null }, true), "G2 87% ⚡");
|
||||
assert.equal(formatBatteryLine({ ...levels, caseCharging: null }, true, "G2"), "G2 87% ⚡ · Case 64% · R1 72%");
|
||||
assert.equal(formatBatteryLine({ ...levels, case: null, ring: null }, true, "G2"), "G2 87% ⚡");
|
||||
assert.equal(
|
||||
formatBatteryLine({ headset: null, headsetCharging: null, case: null, caseCharging: null, ring: null, ringCharging: null }, true),
|
||||
formatBatteryLine({ headset: null, headsetCharging: null, case: null, caseCharging: null, ring: null, ringCharging: null }, true, "G2"),
|
||||
"",
|
||||
);
|
||||
});
|
||||
|
||||
test("the Settings battery line names the paired glasses", () => {
|
||||
assert.equal(formatBatteryLine({ ...levels, case: null, ring: null }, true, "G1"), "G1 87% ⚡");
|
||||
assert.equal(formatBatteryLine({ ...levels, case: null, ring: null }, true, "iO"), "iO 87% ⚡");
|
||||
});
|
||||
Reference in new issue
Block a user