(snapshot, label)
| 1499 | } |
| 1500 | |
| 1501 | function buttonPoint(snapshot, label) { |
| 1502 | const escapedLabel = label.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); |
| 1503 | const match = snapshot.match( |
| 1504 | new RegExp( |
| 1505 | `Button(?:\\s+#[^:\\n]+)?:\\s+${escapedLabel}\\s+@([0-9.]+),([0-9.]+)\\s+([0-9.]+)x([0-9.]+)`, |
| 1506 | ), |
| 1507 | ); |
| 1508 | if (!match) { |
| 1509 | return null; |
| 1510 | } |
| 1511 | return { |
| 1512 | x: Math.round(Number(match[1]) + Number(match[3]) / 2), |
| 1513 | y: Math.round(Number(match[2]) + Number(match[4]) / 2), |
| 1514 | }; |
| 1515 | } |
| 1516 | |
| 1517 | function buttonCandidatePoints(snapshot, label) { |
| 1518 | const point = buttonPoint(snapshot, label); |
no test coverage detected