Changeset 4cc02605


Ignore:
Timestamp:
Oct 24, 2009, 12:59:25 PM (14 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
f9d257b
Parents:
6211c76
git-author:
David Benjamin <davidben@mit.edu> (10/19/09 18:55:11)
git-committer:
David Benjamin <davidben@mit.edu> (10/24/09 12:59:25)
Message:
Add fill-paragraph test case for owl_editwin

One of them currently fails.

Signed-off-by: David Benjamin <davidben@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tester.c

    r23fddad r4cc02605  
    1212int owl_filter_regtest(void);
    1313int owl_obarray_regtest(void);
     14int owl_editwin_regtest(void);
    1415
    1516int main(int argc, char **argv, char **env)
     
    2930  numfailures += owl_filter_regtest();
    3031  numfailures += owl_obarray_regtest();
     32  numfailures += owl_editwin_regtest();
    3133  if (numfailures) {
    3234      fprintf(stderr, "# *** WARNING: %d failures total\n", numfailures);
     
    311313  return numfailed;
    312314}
     315
     316int 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}
Note: See TracChangeset for help on using the changeset viewer.