mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-24 03:02:31 +00:00
[console] Add failing test for adding to full 1-line buffer
I've decided that appending to a full single-line buffer should simply scroll through the existing text. Unsurprisingly, the existing code doesn't handle the situation all that well. While I've already got a fix for it, I think I've got a better idea that will handle full buffers more gracefully.
This commit is contained in:
parent
c8c1d2e642
commit
5e8d18a774
1 changed files with 29 additions and 0 deletions
|
@ -96,6 +96,35 @@ test_2 (void)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
// add a single char at the end of the full buffer the buffer should
|
||||
// just effectively scroll through the text as chars are added (via
|
||||
// the single line object maintaining constant length but updating its
|
||||
// text pointer)
|
||||
Con_BufferAddText (con, "N");
|
||||
if (con->num_lines != 1) {
|
||||
printf ("con_buffer num_lines incorrect: %d\n", con->num_lines);
|
||||
goto fail;
|
||||
}
|
||||
if (con->cur_line != 0) {
|
||||
printf ("con_buffer cur_line incorrect: %d\n", con->cur_line);
|
||||
goto fail;
|
||||
}
|
||||
if (con->lines[con->cur_line].text != con->buffer + 1) {
|
||||
printf ("con_buffer cur_line.text incorrect: %p, %p\n",
|
||||
con->lines[con->cur_line].text, con->buffer + 1);
|
||||
goto fail;
|
||||
}
|
||||
if (con->lines[con->cur_line].len != 1024) {
|
||||
printf ("con_buffer cur_line.line incorrect: %zd\n",
|
||||
con->lines[con->cur_line].len);
|
||||
goto fail;
|
||||
}
|
||||
if (memcmp (con->buffer + 1, text + 1024 + 1, 1024 - 1)
|
||||
|| con->buffer[0] != 'N') {
|
||||
printf ("con_buffer incorrect\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
fail:
|
||||
if (ret) {
|
||||
|
|
Loading…
Reference in a new issue