1 #include <tickit-mockterm.h> 2 3 struct TermLogExpectation { 4 enum { 5 EXPECT_GOTO = LOG_GOTO, 6 EXPECT_PRINT = LOG_PRINT, 7 EXPECT_ERASECH = LOG_ERASECH, 8 EXPECT_CLEAR = LOG_CLEAR, 9 EXPECT_SCROLLRECT = LOG_SCROLLRECT, 10 EXPECT_SETPEN = LOG_SETPEN, 11 } type; 12 int val[6]; 13 char *str; 14 // These must match pen attr names 15 int fg, bg, b, u, i, rv, strike, af; 16 }; 17 18 #define GOTO(line,col) \ 19 &(struct TermLogExpectation){EXPECT_GOTO, .val = {line, col}} 20 #define PRINT(s) \ 21 &(struct TermLogExpectation){EXPECT_PRINT, .str = s} 22 #define ERASECH(count,moveend) \ 23 &(struct TermLogExpectation){EXPECT_ERASECH, .val = {count, moveend}} 24 #define CLEAR() \ 25 &(struct TermLogExpectation){EXPECT_CLEAR} 26 #define SCROLLRECT(top,left,lines,cols,downward,rightward) \ 27 &(struct TermLogExpectation){EXPECT_SCROLLRECT, .val = {top, left, lines, cols, downward, rightward}} 28 // IMPORTANT: set an expectation of this to expect the value 0 explicitly; 29 // 0 will be treated as unspecified 30 #define EXPECT_ZERO 0x100000 31 #define SETPEN(...) \ 32 &(struct TermLogExpectation){EXPECT_SETPEN, __VA_ARGS__} 33 34 TickitTerm *make_term(int lines, int cols); 35 36 void drain_termlog(void); 37 void is_termlog(char *name, ...); 38 39 void press_key(int type, char *str, int mod); 40 void press_mouse(int type, int button, int line, int col, int mod); 41