diff --git a/docs/architecture.md b/docs/architecture.md index 61c2bbfb..0eeb8740 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -95,8 +95,13 @@ browser flows. Reviewed capture photos and metadata live in `test/fixtures/` and use Git LFS. Start with the [fixture guide](../test/fixtures/README.md) before adding one. The Orbit64 browser codec is adapted from `flix-orbit64` under [Apache-2.0](../third_party/flix-orbit64.LICENSE), with -cross-project vectors in `test/cube/notation/orbit64Vectors.json` and -`test/cube/notation/orbit64LargeVectors.json`. +reference vectors from that project in `test/cube/notation/orbit64Vectors.json` +and `test/cube/notation/orbit64LargeVectors.json`. Only the V2 format exists in +the app: [`Orbit64Token.res`](../src/cube/notation/Orbit64Token.res) writes the +color framed token of the notation card for sizes 2-15 and reads color tokens +in the typed-input field. V2 reads the V1 tokens of sizes 2, 3, 4, 6 and 7 as +color framed tokens at offset 0; the 43-character V1 token of a 5x5 cube is not +read. The Orbit64 V2 state codec for 2x2-15x15 cubes ([`Orbit64V2.res`](../src/cube/notation/Orbit64V2.res)) works on orbit diff --git a/docs/user-guide.md b/docs/user-guide.md index 4792c00e..ad658b2f 100644 --- a/docs/user-guide.md +++ b/docs/user-guide.md @@ -167,6 +167,6 @@ Typing facelets never changes the format the notation panel shows: that is the **Colors (WRG)** / **Faces (URF)** switch on the panel (faces by default), also set on the settings page. Input made only of R and B letters fits both formats and is read in that saved format. The notation panel can also -copy an [Orbit64.Net](https://github.com/wstein/flix-orbit64/blob/main/FORMAT.md#spaced-facelet-reference-vectors) -compact state token for 2×2–7×7. Paste facelets or a state token into **Type +copy an [Orbit64](https://github.com/wstein/flix-orbit64/blob/main/FORMAT-V2.md) +compact state token for 2×2–15×15. Paste facelets or a state token into **Type colors**; move and algorithm tokens are separate formats and are not accepted. diff --git a/e2e/notation.spec.ts b/e2e/notation.spec.ts index 0221791b..f7ab4bac 100644 --- a/e2e/notation.spec.ts +++ b/e2e/notation.spec.ts @@ -62,3 +62,45 @@ test('typing colors does not change the saved notation format', async ({ 'cube-assembler-notation=wrg', ) }) + +// Token width of each size (Orbit64 V2 color framed). +const tokenWidths: [number, number][] = [ + [8, 122], + [9, 155], + [10, 195], + [11, 237], + [12, 285], + [13, 336], + [14, 393], + [15, 452], +] + +for (const [size, width] of tokenWidths) { + test(`shows and reads an Orbit64 token of a ${size}x${size} cube`, async ({ + page, + }) => { + const errors: Error[] = [] + page.on('pageerror', (error) => errors.push(error)) + await page.goto('/') + await page.getByRole('button', { name: 'Type colors' }).click() + const facelets = ['U', 'R', 'F', 'D', 'L', 'B'] + .map((face) => face.repeat(size * size)) + .join(' ') + const input = page.getByRole('textbox', { name: /facelets/i }) + await input.fill(facelets) + await page.getByRole('button', { name: 'Apply Facelets' }).click() + const notation = page.getByRole('textbox', { name: 'Notation' }) + await expect(notation).toHaveValue(facelets) + const token = page.locator('.orbit64-token-row code') + await expect(token).toHaveText(/^[A-Za-z0-9_-]+$/) + const value = await token.innerText() + expect(value).toHaveLength(width) + + // Reading the token back gives the same facelets. + await page.getByRole('button', { name: 'Type colors' }).click() + await input.fill(value) + await page.getByRole('button', { name: 'Apply Facelets' }).click() + await expect(notation).toHaveValue(facelets) + expect(errors).toEqual([]) + }) +} diff --git a/src/client/manualFaceletInput.tsx b/src/client/manualFaceletInput.tsx index 725b1b5d..3f290cdd 100644 --- a/src/client/manualFaceletInput.tsx +++ b/src/client/manualFaceletInput.tsx @@ -21,7 +21,7 @@ export function ManualFaceletInput({
{`6 blocks of ${size * size} letters in U R F D L B order, space-separated - face letters (U, R, F, D, L, B: the face each sticker's color matches when solved) or colors (W, O, G, R, B, Y). The format is detected.`}{' '} - You can also paste an Orbit64 2×2–7×7 state token. + You can also paste an Orbit64 2×2–15×15 state token.