fix: make circular and spiral presets truthful

This commit is contained in:
2026-08-30 11:18:51 +09:00
parent 9d937160eb
commit 51c7bbd859
8 changed files with 233 additions and 29 deletions
+48 -1
View File
@@ -572,6 +572,53 @@ test("Array Builder가 preset·직접 편집·검증·표준 JSON round trip을
() => documentObject.documentElement.dataset.arrayValid === "true",
"ellipse ring validation",
);
assert(
documentObject.querySelector("#preset-hint").textContent.includes("실제 내접원"),
"ring hint describes a true circle instead of the boundary perimeter",
);
for (let index = 0; index < microphoneCount(documentObject); index += 1) {
microphoneButtons(documentObject)[index].click();
const [x, y] = selectedCoordinates(documentObject);
assertNear(Math.hypot(x, y), 0.215, 1e-8, "visible ring radius " + index);
}
dispatchValue(
windowObject,
documentObject.querySelector("#preset-type"),
"archimedean",
);
assert(
!documentObject.querySelector("#preset-turns").closest(".field").hidden,
"Archimedean preset exposes its turn count",
);
assert(
documentObject.querySelector("#preset-hint").textContent.includes("r∝θ"),
"Archimedean hint identifies the curved spiral law",
);
dispatchValue(windowObject, documentObject.querySelector("#preset-count"), 9);
dispatchValue(windowObject, documentObject.querySelector("#preset-turns"), 1.5);
documentObject.querySelector("#generate-preset-button").click();
await waitFor(() => microphoneCount(documentObject) === 9, "Archimedean generation");
microphoneButtons(documentObject)[0].click();
assertEqual(
selectedCoordinates(documentObject).join(","),
"0,0,0",
"Archimedean spiral visibly starts at the center",
);
microphoneButtons(documentObject).at(-1).click();
const archimedeanEnd = selectedCoordinates(documentObject);
assertNear(archimedeanEnd[0], -0.215, 1e-8, "1.5-turn spiral ends at -x");
assertNear(archimedeanEnd[1], 0, 1e-8, "1.5-turn spiral endpoint y");
dispatchValue(windowObject, documentObject.querySelector("#preset-type"), "spiral");
assert(
documentObject.querySelector("#preset-turns").closest(".field").hidden,
"Fermat preset does not claim an Archimedean turn count",
);
assert(
documentObject.querySelector("#preset-hint").textContent.includes("해바라기형"),
"Fermat hint explains why its points do not look like one connected curve",
);
dispatchValue(windowObject, documentObject.querySelector("#preset-type"), "random");
dispatchValue(windowObject, documentObject.querySelector("#preset-count"), 12);
@@ -585,7 +632,7 @@ test("Array Builder가 preset·직접 편집·검증·표준 JSON round trip을
assertEqual(repeatedRandom, firstRandom, "same seed repeats the visible layout");
documentObject.querySelector("#undo-button").click();
assertEqual(microphoneCount(documentObject), 8, "preset replacement is undoable");
assertEqual(microphoneCount(documentObject), 9, "preset replacement is undoable");
documentObject.querySelector("#redo-button").click();
assertEqual(microphoneCount(documentObject), 12, "preset replacement is redoable");