Changeset 4cc02605995bbca1c471a2e72d1cb9ba2b42b7f9
- Timestamp:
- 10/24/09 12:59:25 (4 weeks ago)
- Author:
- David Benjamin <davidben@mit.edu>
- git-author:
- David Benjamin <davidben@mit.edu> / 2009-10-19T18:55:11Z-0400
- Parents:
- 6211c76aaa89daad04de5054a29f0cca46630638
- Children:
- f9d257b7036a557ba1d61d6149c5801dbda10d41
- git-committer:
- David Benjamin <davidben@mit.edu> / 2009-10-24T12:59:25Z-0400
- Message:
-
Add fill-paragraph test case for owl_editwin
One of them currently fails.
Signed-off-by: David Benjamin <davidben@mit.edu>
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r23fddad
|
r4cc02605
|
|
| 12 | 12 | int owl_filter_regtest(void); |
| 13 | 13 | int owl_obarray_regtest(void); |
| | 14 | int owl_editwin_regtest(void); |
| 14 | 15 | |
| 15 | 16 | int main(int argc, char **argv, char **env) |
| … |
… |
|
| 29 | 30 | numfailures += owl_filter_regtest(); |
| 30 | 31 | numfailures += owl_obarray_regtest(); |
| | 32 | numfailures += owl_editwin_regtest(); |
| 31 | 33 | if (numfailures) { |
| 32 | 34 | fprintf(stderr, "# *** WARNING: %d failures total\n", numfailures); |
| … |
… |
|
| 311 | 313 | return numfailed; |
| 312 | 314 | } |
| | 315 | |
| | 316 | int owl_editwin_regtest(void) { |
| | 317 | int numfailed = 0; |
| | 318 | const char *p; |
| | 319 | |
| | 320 | printf("# BEGIN testing owl_editwin\n"); |
| | 321 | |
| | 322 | owl_editwin *oe; |
| | 323 | oe = owl_editwin_allocate(); |
| | 324 | owl_editwin_init(oe, NULL, 80, 80, OWL_EDITWIN_STYLE_MULTILINE, NULL); |
| | 325 | |
| | 326 | /* TODO: make the strings a little more lenient w.r.t trailing whitespace */ |
| | 327 | |
| | 328 | /* check paragraph fill */ |
| | 329 | owl_editwin_insert_string(oe, "blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah.\n\nblah"); |
| | 330 | owl_editwin_move_to_top(oe); |
| | 331 | owl_editwin_fill_paragraph(oe); |
| | 332 | p = owl_editwin_get_text(oe); |
| | 333 | FAIL_UNLESS("text was correctly wrapped", p && !strcmp(p, "blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n" |
| | 334 | "blah blah blah.\n" |
| | 335 | "\n" |
| | 336 | "blah")); |
| | 337 | |
| | 338 | /* check that lines ending with ". " correctly fill */ |
| | 339 | owl_editwin_fullclear(oe); |
| | 340 | owl_editwin_insert_string(oe, "blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah. \n\nblah"); |
| | 341 | owl_editwin_move_to_top(oe); |
| | 342 | owl_editwin_fill_paragraph(oe); |
| | 343 | p = owl_editwin_get_text(oe); |
| | 344 | FAIL_UNLESS("text was correctly wrapped", p && !strcmp(p, "blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n" |
| | 345 | "blah blah blah. \n" |
| | 346 | "\n" |
| | 347 | "blah")); |
| | 348 | |
| | 349 | owl_editwin_free(oe); |
| | 350 | |
| | 351 | printf("# END testing owl_editwin (%d failures)\n", numfailed); |
| | 352 | |
| | 353 | return numfailed; |
| | 354 | } |