(t *testing.T)
| 65 | } |
| 66 | |
| 67 | func TestTextInput(t *testing.T) { |
| 68 | // Makes the empty text input field visible and cursor in test outputs. |
| 69 | textFieldRune = '_' |
| 70 | cursorRune = '█' |
| 71 | |
| 72 | tests := []struct { |
| 73 | desc string |
| 74 | callback *callbackTracker |
| 75 | opts []Option |
| 76 | events []terminalapi.Event |
| 77 | canvas image.Rectangle |
| 78 | meta *widgetapi.Meta |
| 79 | want func(size image.Point) *faketerm.Terminal |
| 80 | wantCallback *callbackTracker |
| 81 | wantNewErr bool |
| 82 | wantDrawErr bool |
| 83 | wantEventErr bool |
| 84 | }{ |
| 85 | { |
| 86 | desc: "fails on WidthPerc too low", |
| 87 | opts: []Option{ |
| 88 | WidthPerc(0), |
| 89 | }, |
| 90 | wantNewErr: true, |
| 91 | }, |
| 92 | { |
| 93 | desc: "fails on WidthPerc too high", |
| 94 | opts: []Option{ |
| 95 | WidthPerc(101), |
| 96 | }, |
| 97 | wantNewErr: true, |
| 98 | }, |
| 99 | { |
| 100 | desc: "fails on MaxWidthCells too low", |
| 101 | opts: []Option{ |
| 102 | MaxWidthCells(3), |
| 103 | }, |
| 104 | wantNewErr: true, |
| 105 | }, |
| 106 | { |
| 107 | desc: "fails on HideTextWith control rune", |
| 108 | opts: []Option{ |
| 109 | HideTextWith(0x007f), |
| 110 | }, |
| 111 | wantNewErr: true, |
| 112 | }, |
| 113 | { |
| 114 | desc: "fails on HideTextWith full-width rune", |
| 115 | opts: []Option{ |
| 116 | HideTextWith('世'), |
| 117 | }, |
| 118 | wantNewErr: true, |
| 119 | }, |
| 120 | { |
| 121 | desc: "fails on invalid DefaultText which has control characters", |
| 122 | opts: []Option{ |
| 123 | DefaultText("\r"), |
| 124 | }, |
nothing calls this directly
no test coverage detected