feat(editor): vertex handles, insert and remove, zone move, redraw
U2 Task 5. A selected polygon gets its vertex, « + » and « − » handles (R-9, hidden « + » under two hit radii, R-18 zoom hint in the strip), the handle cap at 40 (R-7), vertex drag and keys, the move mode on the zone or the chosen vertex, « Redessiner » as a redraw mode kept in step with its tracing (R-12 guard, R-13 drop), close radius in CSS px (R-11). The numeric group leaves the properties panel (D1). Removed or rewritten assertions (numeric group -> replacement): - tab « shows its exact stored numbers » (Centre x field) -> the overlay selection circle's cx attribute, same exact value. - tab « a numeric edit » x3 -> « an edit on the drawing »: Enter on the handle without a step commits nothing, a step + Enter commits once; a refused handle drag keeps the stored shape then a drag inside the frame repairs it (issues gone); Escape drops a pending series. - tab C26 « Centre x 15 » -> overlay cx 15. - tab C32 unmeasured « Centre x as text » -> no handle, no field. - tab « adds and removes a vertex as part of the whole group » -> « + » then « − » on the drawing; « never offers to remove below three » -> « − » aria-disabled at 3. - tab H8 « refused Remplacer drops the tracing » -> keeps it open with « Fermeture refusée » (board 33 A); « refused vertex add/remove stay non appliqué » -> a refused vertex drag restores the shape exactly. - tab Désélectionner and D6b (typed Centre x committed, refused, undone) x6 and strip « a new commit replaces the message » -> the same with the Nom (FR) field (a blank name is the refused value). - focus-request « Centre x 20 » -> overlay cx 20. - escape « strip commands keep their Escape » -> a redraw: Escape on the strip or the box cancels it (R-12 row 4); kept for a new zone tracing. - keep-alive « Remplacer tracing kept across Aller à » -> ended by a tab when empty, asked once a vertex is placed (R-12). - e2e annotations: numeric cx edit + undo/redo -> handle keys + undo/ redo; jitter/drag and Task 4 point reads -> overlay attributes (the stored place during the mode -> overlay-old-place); keyboard-only cy and vertex x typed -> handle and vertex keys. - e2e deselect: Centre x typed/refused/committed -> Nom (FR). - e2e geometry, shell-crossing: Centre x/cy reads -> overlay attributes. - e2e journey: cx +3 and vertex x +4 typed -> 3 and 4 arrow steps + Enter; a far typed value + revert -> a far handle drag refused. - e2e equine latency: typed cx rounds -> handle arrow + Enter rounds.
This commit is contained in:
1 parent
ba8e766fe8
commit
6211046537
44 files changed
+3790
-1050
No files matched your search
@@ -6,8 +6,12 @@ import {
|
||||
clickDrawing,
|
||||
clientOf,
|
||||
editorActor,
|
||||
geometryField,
|
||||
historyButton,
|
||||
round2,
|
||||
shownNumber,
|
||||
shownPoints,
|
||||
shownShape,
|
||||
storedShape,
|
||||
pressAtBox,
|
||||
openEditor,
|
||||
pickAnnotation,
|
||||
@@ -25,7 +29,7 @@ import {
|
||||
import { expectNoShift, keepNativeFrames } from '../support/layout'
|
||||
|
||||
// V1-2.6 A3 (contract C7, C8, C21): points, zones and links by clicks and by keyboard,
|
||||
// move by drag, numeric edits, undo and redo, then the save that carries them.
|
||||
// move by drag, edits on the handles (U2 Task 5), undo and redo, then the save.
|
||||
|
||||
const dict = fr
|
||||
|
||||
@@ -84,7 +88,7 @@ test.describe('editor annotations (A3)', () => {
|
||||
await dropLateReplays(context)
|
||||
})
|
||||
|
||||
test('point, zone and link by clicks; numeric edit; undo and redo; save', async ({
|
||||
test('point, zone and link by clicks; handle edit; undo and redo; save', async ({
|
||||
page,
|
||||
requests,
|
||||
}) => {
|
||||
@@ -103,8 +107,8 @@ test.describe('editor annotations (A3)', () => {
|
||||
await createFromPanel(page)
|
||||
await expect(selectionTag(page)).toContainText('Point un')
|
||||
await expect(properties(page)).toBeVisible()
|
||||
const placed = await geometryField(page, dict, 'cx').inputValue()
|
||||
expect(Math.abs(Number(placed) - 300)).toBeLessThan(1)
|
||||
const placed = await shownNumber(page, 'cx')
|
||||
expect(Math.abs(placed - 300)).toBeLessThan(1)
|
||||
|
||||
// A zone: three clicks, then « Fermer le tracé ».
|
||||
await tool(page, 'zone').click()
|
||||
@@ -137,19 +141,22 @@ test.describe('editor annotations (A3)', () => {
|
||||
await expect(selectionTag(page)).toContainText('Accès un')
|
||||
await expect(historyButton(page, dict, 'undo')).toBeEnabled()
|
||||
|
||||
// A numeric edit of the point, then undo and redo.
|
||||
// A keyboard edit on the point's handle (two steps of 5 units), then undo and redo.
|
||||
await tool(page, 'select').click()
|
||||
await pickAnnotation(page, dict, /Point un/)
|
||||
const cx = geometryField(page, dict, 'cx')
|
||||
await cx.fill('420')
|
||||
await cx.press('Enter')
|
||||
await expect(cx).toHaveValue('420')
|
||||
await page.getByRole('button', { name: 'Point Point un' }).focus()
|
||||
await page.keyboard.press('ArrowRight')
|
||||
await page.keyboard.press('ArrowRight')
|
||||
await page.keyboard.press('Enter')
|
||||
const moved = String(round2(round2(placed + 5) + 5))
|
||||
await expect(shownShape(page)).toHaveAttribute('cx', moved)
|
||||
await historyButton(page, dict, 'undo').click()
|
||||
await expect(geometryField(page, dict, 'cx')).toHaveValue(placed)
|
||||
await expect(shownShape(page)).toHaveAttribute('cx', String(placed))
|
||||
await historyButton(page, dict, 'redo').click()
|
||||
await expect(geometryField(page, dict, 'cx')).toHaveValue('420')
|
||||
await expect(shownShape(page)).toHaveAttribute('cx', moved)
|
||||
// Nothing left to redo: the button is aria-disabled and a press changes nothing.
|
||||
await pressAtBox(page, historyButton(page, dict, 'redo'))
|
||||
await expect(geometryField(page, dict, 'cx')).toHaveValue('420')
|
||||
await expect(shownShape(page)).toHaveAttribute('cx', moved)
|
||||
|
||||
await saveDraft(page, dict, seed.revision + 1)
|
||||
const saved = await serverDocument<{
|
||||
@@ -176,9 +183,8 @@ test.describe('editor annotations (A3)', () => {
|
||||
await fillCreation(page, { fr: 'Mobile', en: 'Movable' })
|
||||
await createFromPanel(page)
|
||||
await tool(page, 'select').click()
|
||||
const cx = geometryField(page, dict, 'cx')
|
||||
const cy = geometryField(page, dict, 'cy')
|
||||
const [x0, y0] = [await cx.inputValue(), await cy.inputValue()]
|
||||
const x0 = String(await shownNumber(page, 'cx'))
|
||||
const y0 = String(await shownNumber(page, 'cy'))
|
||||
expect(Math.abs(Number(x0) - 300)).toBeLessThan(1)
|
||||
|
||||
// Jitter under the 4 px threshold: pressed, moved by 3 px, released.
|
||||
@@ -187,8 +193,8 @@ test.describe('editor annotations (A3)', () => {
|
||||
await page.mouse.down()
|
||||
await page.mouse.move(from.x + 2, from.y + 2)
|
||||
await page.mouse.up()
|
||||
await expect(cx).toHaveValue(x0)
|
||||
await expect(cy).toHaveValue(y0)
|
||||
await expect(shownShape(page)).toHaveAttribute('cx', x0)
|
||||
await expect(shownShape(page)).toHaveAttribute('cy', y0)
|
||||
|
||||
// A real drag: the point follows to (400, 360) in drawing units.
|
||||
const to = await clientOf(page, 400, 360)
|
||||
@@ -199,14 +205,14 @@ test.describe('editor annotations (A3)', () => {
|
||||
})
|
||||
await page.mouse.move(to.x, to.y, { steps: 5 })
|
||||
await page.mouse.up()
|
||||
await expect(cx).not.toHaveValue(x0)
|
||||
expect(Math.abs(Number(await cx.inputValue()) - 400)).toBeLessThan(2)
|
||||
expect(Math.abs(Number(await cy.inputValue()) - 360)).toBeLessThan(2)
|
||||
await expect(shownShape(page)).not.toHaveAttribute('cx', x0)
|
||||
expect(Math.abs((await shownNumber(page, 'cx')) - 400)).toBeLessThan(2)
|
||||
expect(Math.abs((await shownNumber(page, 'cy')) - 360)).toBeLessThan(2)
|
||||
await page.keyboard.press('Control+z')
|
||||
await expect(geometryField(page, dict, 'cx')).toHaveValue(x0)
|
||||
await expect(shownShape(page)).toHaveAttribute('cx', x0)
|
||||
})
|
||||
|
||||
test('keyboard only: creation by the add buttons, numeric position, numeric edit', async ({
|
||||
test('keyboard only: creation by the add buttons, numeric position, edit by the handle keys', async ({
|
||||
page,
|
||||
requests,
|
||||
}) => {
|
||||
@@ -230,14 +236,20 @@ test.describe('editor annotations (A3)', () => {
|
||||
await page.keyboard.press('Enter')
|
||||
await expect(creation(page)).toHaveCount(0)
|
||||
await expect(selectionTag(page)).toContainText('Clavier')
|
||||
await expect(geometryField(page, dict, 'cx')).toHaveValue('250')
|
||||
await expect(shownShape(page)).toHaveAttribute('cx', '250')
|
||||
|
||||
const cy = geometryField(page, dict, 'cy')
|
||||
await cy.fill('510.5')
|
||||
await cy.press('Enter')
|
||||
await expect(cy).toHaveValue('510.5')
|
||||
// The handle keys (U2 Task 5): two steps of 5 units down, one commit on Enter.
|
||||
const cy0 = await shownNumber(page, 'cy')
|
||||
await page.getByRole('button', { name: 'Point Clavier' }).focus()
|
||||
await page.keyboard.press('ArrowDown')
|
||||
await page.keyboard.press('ArrowDown')
|
||||
await page.keyboard.press('Enter')
|
||||
await expect(shownShape(page)).toHaveAttribute(
|
||||
'cy',
|
||||
String(round2(round2(cy0 + 5) + 5)),
|
||||
)
|
||||
|
||||
// A polygon edit: the zone added by keyboard, a vertex typed.
|
||||
// A polygon edit: the zone added by keyboard, its first vertex moved by its keys.
|
||||
await page
|
||||
.getByRole('button', { name: dict['editor.annotations.add.zone'] })
|
||||
.focus()
|
||||
@@ -248,13 +260,14 @@ test.describe('editor annotations (A3)', () => {
|
||||
.focus()
|
||||
await page.keyboard.press('Enter')
|
||||
await expect(selectionTag(page)).toContainText('Zone clavier')
|
||||
const vertexX = page.getByLabel(
|
||||
dict['editor.annotations.geometry.vertex_x'].replace('{n}', '1'),
|
||||
)
|
||||
const before = Number(await vertexX.inputValue())
|
||||
await vertexX.fill(String(before + 10))
|
||||
await vertexX.press('Enter')
|
||||
await expect(vertexX).toHaveValue(String(before + 10))
|
||||
const [[before]] = await shownPoints(page)
|
||||
await page.getByRole('button', { name: 'Sommet 1', exact: true }).focus()
|
||||
await page.keyboard.press('ArrowRight')
|
||||
await page.keyboard.press('ArrowRight')
|
||||
await page.keyboard.press('Enter')
|
||||
await expect
|
||||
.poll(async () => (await shownPoints(page))[0][0])
|
||||
.toBe(round2(round2(before + 5) + 5))
|
||||
await saveDraft(page, dict, seed.revision + 1)
|
||||
})
|
||||
|
||||
@@ -416,7 +429,6 @@ test.describe('editor annotations (A3)', () => {
|
||||
await expectAccessible(page, 'a selected point: handle, slider, move')
|
||||
|
||||
// The handle follows the pointer; the drop is one commit.
|
||||
const cx = geometryField(page, dict, 'cx')
|
||||
await expectNoShift(
|
||||
page,
|
||||
async () => {
|
||||
@@ -427,10 +439,9 @@ test.describe('editor annotations (A3)', () => {
|
||||
},
|
||||
swaps,
|
||||
)
|
||||
expect(Math.abs(Number(await cx.inputValue()) - 560)).toBeLessThan(2)
|
||||
expect(Math.abs((await shownNumber(page, 'cx')) - 560)).toBeLessThan(2)
|
||||
|
||||
// A click on the track, no drag (WCAG 2.5.7): one commit at the release.
|
||||
const r = geometryField(page, dict, 'r')
|
||||
const track = (await slider.boundingBox())!
|
||||
await expectNoShift(
|
||||
page,
|
||||
@@ -445,12 +456,12 @@ test.describe('editor annotations (A3)', () => {
|
||||
},
|
||||
swaps,
|
||||
)
|
||||
expect(Number(await r.inputValue())).toBeGreaterThan(40)
|
||||
expect(await shownNumber(page, 'r')).toBeGreaterThan(40)
|
||||
await page.keyboard.press('Control+z')
|
||||
await expect(r).toHaveValue('40')
|
||||
await expect(shownShape(page)).toHaveAttribute('r', '40')
|
||||
|
||||
// The move mode: three steps (5 units each on a 1 000 px wide frame), validated once.
|
||||
const x0 = Number(await cx.inputValue())
|
||||
const x0 = await shownNumber(page, 'cx')
|
||||
await expectNoShift(
|
||||
page,
|
||||
() => button(page, 'editor.annotations.move.point').click(),
|
||||
@@ -466,7 +477,8 @@ test.describe('editor annotations (A3)', () => {
|
||||
},
|
||||
swaps,
|
||||
)
|
||||
await expect(cx).toHaveValue(String(x0))
|
||||
// Nothing committed yet: the stored place stays, drawn as the old place.
|
||||
await expect(storedShape(page)).toHaveAttribute('cx', String(x0))
|
||||
await expectNoShift(
|
||||
page,
|
||||
async () => {
|
||||
@@ -475,7 +487,8 @@ test.describe('editor annotations (A3)', () => {
|
||||
},
|
||||
swaps,
|
||||
)
|
||||
await expect(cx).toHaveValue(String(x0 + 15))
|
||||
await expect(shownShape(page)).toHaveAttribute('cx', String(x0 + 15))
|
||||
await expect(storedShape(page)).toHaveCount(0)
|
||||
await expect(button(page, 'editor.annotations.move.point')).toBeFocused()
|
||||
})
|
||||
|
||||
|
||||
Reference in new issue
Block a user