mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Test scope opacity, the Visual reset and the panel's presets
The share codec carries field 30 and still encodes a link made before it to the same code; the long form writes sco only below full opacity; the mask fades without repainting; the panel shows and sets the opacity, and the reset and the presets call their actions. Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
471151910d
commit
6c1744e55b
6 files changed
+294
-1
No files matched your search
@@ -19,6 +19,8 @@ import {
|
||||
SCOPE_TERMINUS_MAX_PCT,
|
||||
SCOPE_FEATHER_RATIO_DEFAULT,
|
||||
getScopeMaskFeather,
|
||||
setScopeMaskOpacity,
|
||||
getScopeMaskOpacity,
|
||||
SCOPE_OUTSIDE_ALPHA,
|
||||
SCOPE_TERMINUS_ALPHA_NEAR,
|
||||
SCOPE_TERMINUS_FAR_M,
|
||||
@@ -205,6 +207,37 @@ test('scope appearance follows direct state changes and install/destroy lifecycl
|
||||
}
|
||||
});
|
||||
|
||||
test('scope opacity fades the painted mask without repainting it', () => {
|
||||
const dom = stubScopeMaskDom();
|
||||
try {
|
||||
assert.equal(getScopeMaskOpacity(), 1, 'full by default');
|
||||
setScopeMaskOpacity(0.4);
|
||||
installScopeMask({ container: dom.container });
|
||||
assert.equal(dom.canvas.style.opacity, '0.4', 'a choice made before install applies');
|
||||
const paints = { ...dom.ops };
|
||||
const terminus = getScopeTerminusAlpha();
|
||||
setScopeMaskOpacity(0.25);
|
||||
assert.equal(dom.canvas.style.opacity, '0.25');
|
||||
assert.deepEqual(dom.ops, paints, 'the mask is not repainted');
|
||||
assert.equal(getScopeTerminusAlpha(), terminus, 'the terminus is its own setting');
|
||||
setScopeMaskOpacity(3);
|
||||
assert.equal(getScopeMaskOpacity(), 1);
|
||||
setScopeMaskOpacity(-1);
|
||||
assert.equal(getScopeMaskOpacity(), 0);
|
||||
setScopeMaskOpacity('soft');
|
||||
assert.equal(getScopeMaskOpacity(), 1, 'not a number is full');
|
||||
setScopeMaskOpacity(0.5);
|
||||
destroyScopeMask();
|
||||
installScopeMask({ container: dom.container });
|
||||
assert.equal(dom.canvas.style.opacity, '0.5', 'reinstall keeps it');
|
||||
_resetScopeMaskForTest();
|
||||
assert.equal(getScopeMaskOpacity(), 1, 'test reset restores full');
|
||||
} finally {
|
||||
destroyScopeMask();
|
||||
dom.restore();
|
||||
}
|
||||
});
|
||||
|
||||
test('a DPR change with no resize still repaints the backing store', () => {
|
||||
const dom = stubScopeMaskDom({ width: 1000, height: 800, dpr: 1 });
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user