Changeset 58a16cc


Ignore:
Timestamp:
Sep 30, 2010, 8:07:17 PM (14 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, release-1.7, release-1.8, release-1.9
Children:
9c3f334
Parents:
52172cc
git-author:
David Benjamin <davidben@mit.edu> (09/29/10 14:32:59)
git-committer:
David Benjamin <davidben@mit.edu> (09/30/10 20:07:17)
Message:
Add a unit test for the editwin's automatic wrapping

Currently fails because the wrapping doesn't happen.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tester.c

    r9190285 r58a16cc  
    373373  const char *p;
    374374  owl_editwin *oe;
     375  const char *autowrap_string = "we feel our owls should live "
     376                                "closer to our ponies.";
    375377
    376378  printf("# BEGIN testing owl_editwin\n");
     
    427429  owl_editwin_unref(oe); oe = NULL;
    428430
     431  /* Test automatic line-wrapping. */
     432  owl_global_set_edit_maxwrapcols(&g, 10);
     433  oe = owl_editwin_new(NULL, 80, 80, OWL_EDITWIN_STYLE_MULTILINE, NULL);
     434  for (p = autowrap_string; *p; p++) {
     435    owl_input j;
     436    j.ch = *p;
     437    j.uch = *p; /* Assuming ASCII. */
     438    owl_editwin_process_char(oe, j);
     439  }
     440  p = owl_editwin_get_text(oe);
     441  FAIL_UNLESS("text was automatically wrapped",
     442              p && !strcmp(p, "we feel\n"
     443                           "our owls\n"
     444                           "should\n"
     445                           "live\n"
     446                           "closer to\n"
     447                           "our\n"
     448                           "ponies."));
     449  owl_editwin_unref(oe); oe = NULL;
     450  owl_global_set_edit_maxwrapcols(&g, 70);
     451
    429452  printf("# END testing owl_editwin (%d failures)\n", numfailed);
    430453
Note: See TracChangeset for help on using the changeset viewer.