同步 sgs-frontend-mobile 源码
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-27 11:26:01 +08:00
parent 575dca430f
commit 9ea1bfab71
181 changed files with 24395 additions and 5212 deletions

View File

@@ -0,0 +1,26 @@
import { describe, expect, it } from 'vitest'
import { getGuideRendererPixelRatio } from '@/services/performance/rendererPerformance'
describe('rendererPerformance', () => {
it('keeps desktop high-density displays within the desktop cap', () => {
expect(getGuideRendererPixelRatio({ devicePixelRatio: 3, viewportWidth: 1440 }, 1.5)).toBe(1.5)
})
it('uses a lower pixel ratio cap on mobile displays', () => {
expect(getGuideRendererPixelRatio({
devicePixelRatio: 3,
maxTouchPoints: 5,
viewportWidth: 390,
userAgent: 'iPhone'
}, 1.5)).toBe(1.25)
})
it('uses the minimum cap for constrained devices or save-data mode', () => {
expect(getGuideRendererPixelRatio({
devicePixelRatio: 2,
deviceMemory: 2,
hardwareConcurrency: 2,
saveData: true
}, 1.5)).toBe(1)
})
})