- commit
- 0c85478a6f041853a9b150fb6a74817bf85a6c6d
- parent
- 0084f487a84983dd0f1c2d45e538a11fcd6764d5
- author
- Dami <dami.etoile@gmail.com>
| M | internal/ | 27 | +++++++++++++++++++++++++++ |
@@ -215,6 +215,33 @@ func TestRecordingAnswersAndSkips(t *testing.T) {
215215 }216216 }217217 218+func TestRecordingTheMouse(t *testing.T) {219+ for _, relative := range []bool{false, true} {220+ m := newModel()221+ press(t, m, "1", "<enter>", "2", "<enter>", "<up>", "<up>", "<shift+down>")222+ run(m, m.runCommand(map[bool]string{false: "macro.record", true: "macro.record_relative"}[relative]))223+ m.startFill() // drag the fill handle from A1:A2 down to A5224+ m.dragFillTo(addr("A5"))225+ m.finishFill()226+ m.autofit(1) // double-click column B's border227+ run(m, m.runCommand("macro.stop"))228+ press(t, m, "<enter>", "<enter>")229+ want := `fill(to="A1:A5")` + "\n" + `set_width("B", 3)`230+ if relative {231+ want = `fill(rows=3)` + "\n" + `set_width("B", 3)`232+ }233+ if got := body(mustMacro(t, m, "Macro 1").Source); got != want {234+ t.Errorf("relative %v: recorded\n%s\nwant\n%s", relative, got, want)235+ }236+ r := withMacro(t, m, "Macro 1")237+ press(t, r, "1", "<enter>", "2", "<enter>", "<up>", "<up>", "<shift+down>")238+ run(r, r.runMacro(mustMacro(t, r, "Macro 1")))239+ if input(r, "A5") != "5" || r.sheet.ColWidth(1) != 3 {240+ t.Errorf("relative %v: A5 %q, width %d, %q", relative, input(r, "A5"), r.sheet.ColWidth(1), r.warn)241+ }242+ }243+}244+218245 func TestStopWithNothingRecorded(t *testing.T) {219246 m := newModel()220247 run(m, m.runCommand("macro.record"))