mock: スタビ位置は、どのサイズも何も選ばない状態から始める(T-30 単位8)

候補が1つのサイズも既定で選ばない。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017yoUu9Xd8dhwyQdCfKfaXG
This commit is contained in:
2026-10-23 22:18:50 +09:00
co-authored by Claude Opus 5.5
parent eacf8a1581
commit 785daa23c2
4 changed files with 9 additions and 29 deletions
+5 -14
View File
@@ -1,10 +1,5 @@
import { describe, expect, it } from "vitest";
import {
defaultStabilizerSelection,
stabilizerCandidates,
stabilizerPoints,
switchPoint,
} from "../src/domain/stabilizers";
import { stabilizerCandidates, stabilizerPoints, switchPoint } from "../src/domain/stabilizers";
import { mountMarks, selectedStabilizers, stabilizerSelections, withStabilizers } from "../src/ui/phy/logic";
import type { KeyNode } from "../src/domain/phy";
import type { ProjectFile } from "../src/domain/project";
@@ -34,10 +29,6 @@ describe("stabilizer candidates", () => {
expect(stabilizerCandidates({ w: 1.25, h: 2, w2: 1.5, h2: 1, x2: -0.25 })).toEqual([]);
expect(stabilizerCandidates({ w: 2, h: 1, w2: 2.25 })).toEqual([]);
});
it("selects a lone candidate by default and nothing when there are several", () => {
expect(defaultStabilizerSelection({ w: 2, h: 1 })).toEqual(["11.938mm"]);
expect(defaultStabilizerSelection({ w: 6.25, h: 1 })).toEqual([]);
});
it("places mounts around the rectangle center along the long axis", () => {
expect(stabilizerPoints({ w: 7, h: 1 }, ["3u"])).toEqual([
{ x: 0.5, y: 0.5 },
@@ -57,9 +48,9 @@ describe("stabilizer candidates", () => {
describe("stabilizer selections in ProjectFile.ui", () => {
const project = { ui: { other: 1 } } as unknown as ProjectFile;
it("falls back to the size default and drops ids the size no longer offers", () => {
expect(selectedStabilizers({}, key("a", 2))).toEqual(["11.938mm"]);
expect(selectedStabilizers({ a: [] }, key("a", 2))).toEqual([]);
it("selects nothing by default and drops ids the size no longer offers", () => {
expect(selectedStabilizers({}, key("a", 2))).toEqual([]);
expect(selectedStabilizers({ a: ["11.938mm"] }, key("a", 2))).toEqual(["11.938mm"]);
expect(selectedStabilizers({ a: ["2.5u", "3u"] }, key("a", 6))).toEqual(["2.5u"]);
});
it("writes per key without touching other ui state", () => {
@@ -86,7 +77,7 @@ describe("stabilizer selections in ProjectFile.ui", () => {
},
],
{ g: "v2" },
{},
{ a: ["11.938mm"] },
);
expect(marks.map((m) => m.id)).toEqual(["a", "c"]);
expect(marks[1]!.transform.f).toBe(1);