forked from Blendman974/faceclaw
[verified] fix: hide notification background only on screen wake
This commit is contained in:
1 parent
22df4d76d9
commit
9ddc864b0d
6 files changed
+75
-20
No files matched your search
@@ -7,7 +7,7 @@ const { encodeShellScene } = require('../.test-build/app/graphics/shell-scene.js
|
||||
const { readPresentation, paintPresentation } = require('../.test-build/app/graphics/presentation-wire.js');
|
||||
const { DrawOp } = require('../.test-build/app/graphics/display-list.js');
|
||||
|
||||
function fixture(width = 640, height = 480, retained = false) {
|
||||
function fixture(width = 640, height = 480, retained = false, hideBackground = true) {
|
||||
const screen = { width, height, top: 0 };
|
||||
const load = loader({}, {
|
||||
'../graphics/image': graphics, '../graphics/plane': planes,
|
||||
@@ -41,7 +41,7 @@ function fixture(width = 640, height = 480, retained = false) {
|
||||
},
|
||||
handleInput() {},
|
||||
};
|
||||
const modal = new ShellModalLayer(inner, noopLayerActions, { removed() { removed++; } });
|
||||
const modal = new ShellModalLayer(inner, noopLayerActions, { hideBackground, removed() { removed++; } });
|
||||
return { screen, stack, modal, modalRect, innerSize: () => innerSize, lowerPaints: () => lowerPaints, removed: () => removed };
|
||||
}
|
||||
|
||||
@@ -88,6 +88,18 @@ test('G2 notification serializes through the production shell scene within one 6
|
||||
assert.ok(mask.calls.every(call => call.op === DrawOp.CLEAR && call.color === 0 && call.clip));
|
||||
});
|
||||
|
||||
test('an already-awake notification keeps app and chrome visible with no blackout presentation', () => {
|
||||
const f = fixture(640, 480, false, false);
|
||||
f.stack.push(f.modal);
|
||||
const { frame, layers } = sceneFrame(f);
|
||||
assert.equal(f.lowerPaints(), 1, 'chrome is painted underneath the popup');
|
||||
assert.equal(layers.length, 2);
|
||||
assert.equal(frame.getPixel(639, 479), 200, 'app is visible outside the popup');
|
||||
assert.equal(frame.getPixel(0, 0), 170, 'chrome remains visible');
|
||||
assert.ok(frame.pixels.includes(240), 'popup still appears above the app');
|
||||
assert.ok(layers.every(layer => layer.selections.length === 0), 'no margin mask for an already-on screen');
|
||||
});
|
||||
|
||||
test('notification omits chrome and blacks out a separate app until dismissed', () => {
|
||||
const f = fixture(), before = sceneFrame(f).frame;
|
||||
assert.equal(f.lowerPaints(), 1);
|
||||
|
||||
Reference in new issue
Block a user