forked from Blendman974/faceclaw
Merge branch 'main' of https://github.com/jimrandomh/faceclaw
This commit is contained in:
commit
d01dbf5432
19 files changed
+268
-43
No files matched your search
@@ -0,0 +1,57 @@
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const { loader } = require('./helpers/load-typescript.cjs');
|
||||
|
||||
function harness(width, height) {
|
||||
const font = { lineHeight: 20, measureText: text => text.length * 10, getGlyph: () => ({ dwidthX: 10 }) };
|
||||
const load = loader({}, { './onboarding-fonts': { onboardingFont: () => font } });
|
||||
const { IosPrivacyPage } = load('app/apps/onboarding/ios-privacy-page.ts');
|
||||
const { IOS_PRIVACY_NOTICE } = load('app/analytics/privacy-disclosure.ts');
|
||||
const page = new IosPrivacyPage();
|
||||
let next = 0;
|
||||
return {
|
||||
page, notice: IOS_PRIVACY_NOTICE, get next() { return next; },
|
||||
input(type) { page.handleInput({ type }, { next: () => next++ }); },
|
||||
paint() {
|
||||
const rows = [];
|
||||
page.paint({ width, height, drawText(font, x, y, text) {
|
||||
assert.ok(x + font.measureText(text) <= width, `horizontal overflow: ${text}`);
|
||||
assert.ok(y >= 0 && y + font.lineHeight <= height, `vertical overflow: ${text}`);
|
||||
rows.push({ y, text });
|
||||
} });
|
||||
return rows;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
for (const [width, height] of [[576, 188], [576, 260], [640, 432]]) {
|
||||
test(`entire iOS notice is readable before continuing at ${width}x${height}`, () => {
|
||||
const h = harness(width, height);
|
||||
const shown = [];
|
||||
for (let i = 0; !h.next && i < 30; i++) {
|
||||
const rows = h.paint();
|
||||
const footer = rows.at(-1);
|
||||
for (const row of rows.slice(1, -1)) {
|
||||
assert.ok(row.y + 20 <= footer.y, 'body must not overlap navigation');
|
||||
shown.push(row.text);
|
||||
}
|
||||
h.input('click');
|
||||
}
|
||||
assert.equal(h.next, 1);
|
||||
// Line breaking may also split after punctuation (e.g. device/app).
|
||||
assert.equal(shown.join('').replace(/\s+/g, ''), h.notice.replace(/\s+/g, ''));
|
||||
});
|
||||
}
|
||||
|
||||
test('scrolling stays inside the notice; revisiting starts at the beginning', () => {
|
||||
const h = harness(576, 188);
|
||||
const first = h.paint().map(row => row.text);
|
||||
h.input('scroll-up');
|
||||
assert.deepEqual(h.paint().map(row => row.text), first);
|
||||
h.input('scroll-down');
|
||||
assert.notDeepEqual(h.paint().map(row => row.text), first);
|
||||
for (let i = 0; i < 30; i++) h.input('scroll-down');
|
||||
assert.equal(h.next, 0, 'scrolling must not accept the notice');
|
||||
h.page.enter();
|
||||
assert.deepEqual(h.paint().map(row => row.text), first);
|
||||
});
|
||||
+4
-2
@@ -10,9 +10,11 @@ import kotlin.test.*
|
||||
*/
|
||||
class PreviewAnimationListenerTest {
|
||||
// FrameDisplayListTest's menu golden (a 2x2 highlight sliding in to rest at (3, 2)),
|
||||
// restarted at 0 of its 240 ms so the slide is still in flight at the first pull.
|
||||
// restarted at 1 of its 240 ms so the slide is still in flight at the first pull. Not 0:
|
||||
// at exactly 0 the highlight is wholly above this 8x8 screen, so a pull in the same
|
||||
// millisecond as the submit (a warm JIT) would match the settled frame.
|
||||
private val menu = "077f0000000300020002000200022a00000096000000010002000200ffffffff0200080000ff24017e30020000000001812c8001812c1611010017328001812c16103001812c3023414031ff24017c30020000000001812c8001812c1611010017328001812c16103001812c30234140310200020001000103100400000000000000001f"
|
||||
.chunked(2).map { it.toInt(16).toByte() }.toByteArray().also { it.fill(0, 18, 22) }
|
||||
.chunked(2).map { it.toInt(16).toByte() }.toByteArray().also { it.fill(0, 18, 22); it[18] = 1 }
|
||||
|
||||
private fun settledPreview(): ByteArray {
|
||||
val reader = ArrayByteReader(menu)
|
||||
|
||||
@@ -453,7 +453,7 @@ class GlassesSessionCoreTest {
|
||||
s.core.interruptibleSleep.interrupt()
|
||||
assertTrue(waitUntil(3_000) { s.listener.phases.contains("retrying") }, s.host.logs().takeLast(10).toString())
|
||||
assertTrue(s.host.hasLog("message timed out: create-layout"))
|
||||
assertTrue(s.host.hasLog("Transport failure: ack timeout"))
|
||||
assertTrue(s.host.hasLog("Transport failure: create layout ack timeout"))
|
||||
assertTrue(s.link.disconnected.containsAll(listOf(RIGHT, LEFT)))
|
||||
s.core.disconnect()
|
||||
assertEquals("disconnected", s.listener.phases.last())
|
||||
|
||||
Reference in new issue
Block a user