mirror of
https://github.com/Boof2015/prism.git
synced 2026-08-28 16:50:57 +02:00
fix window snap issue
This commit is contained in:
@@ -13,7 +13,10 @@ import {
|
||||
getHorizontalWheelScrollResult,
|
||||
normalizeWheelDelta,
|
||||
} from '../src/renderer/utils/horizontalWheelScroll'
|
||||
import { resolveMainWindowSettingsHeight } from '../src/renderer/mainWindowSettings'
|
||||
import {
|
||||
resolveMainWindowSettingsHeight,
|
||||
resolveMainWindowSettingsPanelHeight,
|
||||
} from '../src/renderer/mainWindowSettings'
|
||||
import {
|
||||
formatAstraTime,
|
||||
getAstraPlaybackProgress,
|
||||
@@ -2670,6 +2673,32 @@ test('resolveMainWindowSettingsHeight waits for real measurements instead of usi
|
||||
assert.equal(resolveMainWindowSettingsHeight(true, 312, 96), 408)
|
||||
})
|
||||
|
||||
test('resolveMainWindowSettingsPanelHeight uses intrinsic scope-track height when the panel is stretched', () => {
|
||||
const globalWithStyle = globalThis as typeof globalThis & {
|
||||
getComputedStyle?: (element: Element) => CSSStyleDeclaration
|
||||
}
|
||||
const previousGetComputedStyle = globalWithStyle.getComputedStyle
|
||||
|
||||
globalWithStyle.getComputedStyle = () => ({
|
||||
paddingTop: '10px',
|
||||
paddingBottom: '4px',
|
||||
}) as CSSStyleDeclaration
|
||||
|
||||
try {
|
||||
const stretchedPanel = { scrollHeight: 640 } as HTMLElement
|
||||
const collapsedScopeTrack = { scrollHeight: 220.25 } as HTMLElement
|
||||
|
||||
assert.equal(resolveMainWindowSettingsPanelHeight(stretchedPanel, collapsedScopeTrack), 235)
|
||||
assert.equal(resolveMainWindowSettingsPanelHeight(stretchedPanel, null), 640)
|
||||
} finally {
|
||||
if (previousGetComputedStyle) {
|
||||
globalWithStyle.getComputedStyle = previousGetComputedStyle
|
||||
} else {
|
||||
delete globalWithStyle.getComputedStyle
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
test('expanded main-window bounds can push upward into an overlapping display above', () => {
|
||||
const resolved = resolveExpandedMainWindowBounds(
|
||||
{ x: 700, y: 1110, width: 900, height: 180 },
|
||||
|
||||
Reference in New Issue
Block a user