fix: 修复精确预览放大后右侧留白丢失
This commit is contained in:
@@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
getPdfCanvasRenderScale,
|
||||
getPdfPageCssDimensions,
|
||||
getPrecisePdfDocumentWidth,
|
||||
PDF_PAGE_CSS_SCALE
|
||||
} from "../src/pdf-page-geometry";
|
||||
|
||||
@@ -31,4 +32,26 @@ describe("精确 PDF 页面尺寸", () => {
|
||||
);
|
||||
expect(getPdfCanvasRenderScale(0, 800, 2)).toBe(0);
|
||||
});
|
||||
|
||||
it.each([
|
||||
[50, 457],
|
||||
[100, 854],
|
||||
[120, 1013],
|
||||
[400, 3235]
|
||||
])("在 %i%% 缩放下把双侧固定留白计入滚动宽度", (zoom, expected) => {
|
||||
expect(
|
||||
getPrecisePdfDocumentWidth(
|
||||
[595.275591],
|
||||
zoom / 100,
|
||||
30
|
||||
)
|
||||
).toBe(expected);
|
||||
});
|
||||
|
||||
it("按混合纸张中最宽页面计算精确预览滚动宽度", () => {
|
||||
expect(
|
||||
getPrecisePdfDocumentWidth([595.275591, 792], 1.2, 30)
|
||||
).toBe(1328);
|
||||
expect(getPrecisePdfDocumentWidth([], 1.2, 30)).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user