File: test_buffer_redo.c

package info (click to toggle)
mle 1.7.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,108 kB
  • sloc: ansic: 13,335; sh: 728; php: 228; makefile: 83
file content (32 lines) | stat: -rw-r--r-- 837 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "test.h"

char *str = "hi";

void test(buffer_t *buf, mark_t *cur) {
    char *data;
    bint_t data_len;
    int action_group;

    buffer_delete(buf, 0, 1);
    buffer_undo(buf);
    buffer_redo(buf);
    buffer_get(buf, &data, &data_len);
    ASSERT("del", 0, strncmp(data, "i", data_len));

    buffer_insert(buf, 0, "y", 1, NULL);
    buffer_undo(buf);
    buffer_redo(buf);
    buffer_get(buf, &data, &data_len);
    ASSERT("ins", 0, strncmp(data, "yi", data_len));

    action_group = 0;
    buffer_set_action_group_ptr(buf, &action_group);

    buffer_insert(buf, 2, "e", 1, NULL);
    buffer_insert(buf, 3, "ld", 2, NULL);
    action_group += 1;
    buffer_undo_action_group(buf);
    buffer_redo_action_group(buf);
    buffer_get(buf, &data, &data_len);
    ASSERT("ins_group", 0, strncmp(data, "yield", data_len));
}