[verified] fix: hide notification background only on screen wake

This commit is contained in:
MasterControl committed 2026-11-10 20:33:16 +00:00
1 parent 22df4d76d9
commit 9ddc864b0d
6 files changed
+75 -20

No files matched your search

+14 -2
View File
@@ -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);
+16 -2
View File
@@ -3,13 +3,27 @@ const assert = require("node:assert/strict");
const { NotificationModalQueue } = require("../.test-build/app/ui/shell/notification-modal-queue.js");
test('background visibility follows each arrival, independently of inherited return-to-sleep state', () => {
const host = makeHost();
const queue = new NotificationModalQueue(host);
queue.post('wake', true);
queue.post('already-on', false);
assert.equal(host.opened[0].hideBackground, true);
queue.closed(host.opened[0]);
assert.equal(host.opened[1].hideBackground, false, 'queued arrivals must not inherit the first popup mask');
queue.closed(host.opened[1]);
assert.equal(host.sleeps, 1, 'sleep restoration is still inherited across the queue');
queue.post('normal', false);
assert.equal(host.opened[2].hideBackground, false);
});
/** A host that records opened modals (one handle object each) and sleeps. */
function makeHost(unavailable = new Set()) {
const host = {
opened: [],
sleeps: 0,
open(notificationKey) {
const modal = { notificationKey };
open(notificationKey, hideBackground) {
const modal = { notificationKey, hideBackground };
host.opened.push(modal);
return modal;
},