int main(void) { xorn_revision_t rev0, rev1, rev2, rev3; xorn_object_t ob0, ob1a, ob1b; xorn_selection_t sel; setup(&rev0, &rev1, &rev2, &rev3, &ob0, &ob1a, &ob1b); assert(sel = xorn_select_none()); assert(xorn_object_is_selected(rev0, sel, ob0) == false); assert(xorn_object_is_selected(rev0, sel, ob1a) == false); assert(xorn_object_is_selected(rev0, sel, ob1b) == false); assert(xorn_object_is_selected(rev1, sel, ob0) == false); assert(xorn_object_is_selected(rev1, sel, ob1a) == false); assert(xorn_object_is_selected(rev1, sel, ob1b) == false); assert(xorn_object_is_selected(rev2, sel, ob0) == false); assert(xorn_object_is_selected(rev2, sel, ob1a) == false); assert(xorn_object_is_selected(rev2, sel, ob1b) == false); assert(xorn_object_is_selected(rev3, sel, ob0) == false); assert(xorn_object_is_selected(rev3, sel, ob1a) == false); assert(xorn_object_is_selected(rev3, sel, ob1b) == false); xorn_free_selection(sel); assert(sel = xorn_select_object(ob1a)); assert(xorn_object_is_selected(rev0, sel, ob0) == false); assert(xorn_object_is_selected(rev0, sel, ob1a) == false); assert(xorn_object_is_selected(rev0, sel, ob1b) == false); assert(xorn_object_is_selected(rev1, sel, ob0) == false); assert(xorn_object_is_selected(rev1, sel, ob1a) == false); assert(xorn_object_is_selected(rev1, sel, ob1b) == false); assert(xorn_object_is_selected(rev2, sel, ob0) == false); assert(xorn_object_is_selected(rev2, sel, ob1a) == true); assert(xorn_object_is_selected(rev2, sel, ob1b) == false); assert(xorn_object_is_selected(rev3, sel, ob0) == false); assert(xorn_object_is_selected(rev3, sel, ob1a) == false); assert(xorn_object_is_selected(rev3, sel, ob1b) == false); xorn_free_selection(sel); assert(sel = xorn_select_all(rev3)); assert(xorn_object_is_selected(rev0, sel, ob0) == false); assert(xorn_object_is_selected(rev0, sel, ob1a) == false); assert(xorn_object_is_selected(rev0, sel, ob1b) == false); assert(xorn_object_is_selected(rev1, sel, ob0) == true); assert(xorn_object_is_selected(rev1, sel, ob1a) == false); assert(xorn_object_is_selected(rev1, sel, ob1b) == false); assert(xorn_object_is_selected(rev2, sel, ob0) == true); assert(xorn_object_is_selected(rev2, sel, ob1a) == false); assert(xorn_object_is_selected(rev2, sel, ob1b) == true); assert(xorn_object_is_selected(rev3, sel, ob0) == true); assert(xorn_object_is_selected(rev3, sel, ob1a) == false); assert(xorn_object_is_selected(rev3, sel, ob1b) == true); xorn_free_selection(sel); xorn_free_revision(rev3); xorn_free_revision(rev2); xorn_free_revision(rev1); xorn_free_revision(rev0); return 0; }
int main(void) { xorn_revision_t rev0, rev1, rev2, rev3; xorn_object_t ob0, ob1a, ob1b; xorn_selection_t sel0, sel1; xorn_revision_t rev4; xorn_object_t *objects; size_t count; setup(&rev0, &rev1, &rev2, &rev3, &ob0, &ob1a, &ob1b); rev4 = xorn_new_revision(rev2); assert(rev4 != NULL); sel0 = xorn_select_all(rev3); assert(sel0 != NULL); sel1 = xorn_copy_objects(rev4, rev2, sel0, NULL); assert(sel1 != NULL); xorn_finalize_revision(rev4); assert(xorn_object_is_selected(rev4, sel0, ob0)); assert(!xorn_object_is_selected(rev4, sel0, ob1a)); assert(xorn_object_is_selected(rev4, sel0, ob1b)); assert(!xorn_object_is_selected(rev4, sel1, ob0)); assert(!xorn_object_is_selected(rev4, sel1, ob1a)); assert(!xorn_object_is_selected(rev4, sel1, ob1b)); assert(xorn_get_objects(rev4, &objects, &count) == 0); assert(objects != NULL); assert(count == 5); assert(objects[0] == ob0); assert(objects[1] == ob1a); assert(objects[2] == ob1b); assert(!xorn_object_is_selected(rev4, sel0, objects[3])); assert(!xorn_object_is_selected(rev4, sel0, objects[4])); assert(xorn_object_is_selected(rev4, sel1, objects[3])); assert(xorn_object_is_selected(rev4, sel1, objects[4])); free(objects); xorn_free_selection(sel1); xorn_free_selection(sel0); xorn_free_revision(rev4); xorn_free_revision(rev3); xorn_free_revision(rev2); xorn_free_revision(rev1); xorn_free_revision(rev0); return 0; }
static PyObject *select_all( PyObject *self, PyObject *args, PyObject *kwds) { PyObject *rev_arg = NULL; static char *kwlist[] = { "rev", NULL }; if (!PyArg_ParseTupleAndKeywords( args, kwds, "O!:select_all", kwlist, &RevisionType, &rev_arg)) return NULL; xorn_selection_t sel = xorn_select_all(((Revision *)rev_arg)->rev); return sel ? build_selection(sel) : PyErr_NoMemory(); }
static void try_modify(xorn_revision_t rev, xorn_object_t existing_ob, bool expected_result) { xorn_object_t ob0, ob1; xorn_selection_t sel0, sel1; xorn_error_t err; xorn_error_t expected_err = expected_result ? NO_ERROR : xorn_error_revision_not_transient; err = NO_ERROR; ob0 = xornsch_add_line(rev, &line_data, &err); assert((ob0 != NULL) == expected_result); assert(err == expected_err); err = NO_ERROR; assert((xornsch_set_box_data(rev, existing_ob, &box_data, &err) == 0) == expected_result); assert(err == expected_err); err = NO_ERROR; ob1 = xorn_copy_object(rev, rev, existing_ob, &err); assert((ob1 != NULL) == expected_result); assert(err == expected_err); xorn_object_t del_ob = expected_result ? ob1 : existing_ob; err = NO_ERROR; assert((xorn_delete_object(rev, del_ob, &err) == 0) == expected_result); assert(err == expected_err); assert(xorn_object_exists_in_revision(rev, del_ob) == !expected_result); sel0 = xorn_select_all(rev); assert(sel0 != NULL); err = NO_ERROR; sel1 = xorn_copy_objects(rev, rev, sel0, &err); assert((sel1 != NULL) == expected_result); assert(err == expected_err); xorn_free_selection(sel1); err = NO_ERROR; assert((xorn_delete_selected_objects(rev, sel0, &err) == 0) == expected_result); assert(err == expected_err); assert(xorn_object_exists_in_revision(rev, existing_ob) == !expected_result); xorn_free_selection(sel0); }
int main() { xorn_revision_t rev; xorn_object_t ob0, ob1; struct xornsch_component component_data; struct xornsch_picture picture_data; xorn_selection_t sel0, sel1; assert(rev = xorn_new_revision(NULL)); memset(&component_data, 0, sizeof component_data); component_data.symbol.ptr = &refcnt0; component_data.symbol.incref = (void (*)(void *))inc; component_data.symbol.decref = (void (*)(void *))dec; assert(ob0 = xornsch_add_component(rev, &component_data)); assert(refcnt0 == 1); memset(&picture_data, 0, sizeof picture_data); picture_data.pixmap.ptr = &refcnt1; picture_data.pixmap.incref = (void (*)(void *))inc; picture_data.pixmap.decref = (void (*)(void *))dec; assert(ob1 = xornsch_add_picture(rev, &picture_data)); assert(refcnt0 == 1); assert(refcnt1 == 1); assert(sel0 = xorn_select_all(rev)); assert(sel1 = xorn_copy_objects(rev, rev, sel0)); assert(refcnt0 != 0); assert(refcnt1 != 0); memset(&picture_data, 0, sizeof picture_data); assert(xornsch_set_picture_data(rev, ob1, &picture_data) == 0); assert(refcnt0 != 0); assert(refcnt1 != 0); xorn_delete_selected_objects(rev, sel1); assert(refcnt0 == 1); assert(refcnt1 == 0); xorn_free_selection(sel1); xorn_free_selection(sel0); xorn_free_revision(rev); assert(refcnt0 == 0); assert(refcnt1 == 0); return 0; }
int main(void) { xorn_revision_t rev0, rev1, rev2, rev3; xorn_object_t ob0, ob1a, ob1b; xorn_selection_t sel0, sel1, sel2, sel3; xorn_revision_t rev4; struct xorn_double2d pos; struct xornsch_text text_data; xorn_object_t text_ob; xorn_selection_t text_sel; xorn_revision_t rev5; struct xornsch_line_attr line; struct xornsch_fill_attr fill; setup(&rev0, &rev1, &rev2, &rev3, &ob0, &ob1a, &ob1b); sel0 = xorn_select_all(rev0); assert(sel0 != NULL); sel1 = xorn_select_all(rev1); assert(sel1 != NULL); sel2 = xorn_select_all(rev2); assert(sel2 != NULL); sel3 = xorn_select_all(rev3); assert(sel3 != NULL); rev4 = xorn_new_revision(rev3); assert(rev4 != NULL); assert(xornsch_set_color(rev4, sel0, 70) == 0); assert_color(rev4, ob0, true, 4); assert_color(rev4, ob1a, false, 0); assert_color(rev4, ob1b, true, 3); assert(xornsch_set_color(rev4, sel1, 71) == 0); assert_color(rev4, ob0, true, 71); assert_color(rev4, ob1a, false, 0); assert_color(rev4, ob1b, true, 3); assert(xornsch_set_color(rev4, sel2, 72) == 0); assert_color(rev4, ob0, true, 72); assert_color(rev4, ob1a, false, 0); assert_color(rev4, ob1b, true, 72); assert(xornsch_set_color(rev4, sel3, 73) == 0); assert_color(rev4, ob0, true, 73); assert_color(rev4, ob1a, false, 0); assert_color(rev4, ob1b, true, 73); assert(xornsch_set_line_width(rev4, sel0, 8.0) == 0); assert_line_width(rev4, ob0, false, 0.); assert_line_width(rev4, ob1a, false, 0.); assert_line_width(rev4, ob1b, true, 1.); assert(xornsch_set_line_width(rev4, sel1, 8.1) == 0); assert_line_width(rev4, ob0, false, 0.); assert_line_width(rev4, ob1a, false, 0.); assert_line_width(rev4, ob1b, true, 1.); assert(xornsch_set_line_width(rev4, sel2, 8.2) == 0); assert_line_width(rev4, ob0, false, 0.); assert_line_width(rev4, ob1a, false, 0.); assert_line_width(rev4, ob1b, true, 8.2); assert(xornsch_set_line_width(rev4, sel3, 8.3) == 0); assert_line_width(rev4, ob0, false, 0.); assert_line_width(rev4, ob1a, false, 0.); assert_line_width(rev4, ob1b, true, 8.3); pos.x = 9.00; pos.y = 9.05; assert(xornsch_set_pos(rev4, sel0, &pos) == 0); assert_position(rev4, ob0, true, 0., 1.); assert_position(rev4, ob1a, false, 0., 0.); assert_position(rev4, ob1b, true, -1., -1.); pos.x = 9.10; pos.y = 9.15; assert(xornsch_set_pos(rev4, sel1, &pos) == 0); assert_position(rev4, ob0, true, 9.10, 9.15); assert_position(rev4, ob1a, false, 0., 0.); assert_position(rev4, ob1b, true, -1., -1.); pos.x = 9.20; pos.y = 9.25; assert(xornsch_set_pos(rev4, sel2, &pos) == 0); assert_position(rev4, ob0, true, 9.20, 9.25); assert_position(rev4, ob1a, false, 0., 0.); assert_position(rev4, ob1b, true, 9.20, 9.25); pos.x = 9.30; pos.y = 9.35; assert(xornsch_set_pos(rev4, sel3, &pos) == 0); assert_position(rev4, ob0, true, 9.30, 9.35); assert_position(rev4, ob1a, false, 0., 0.); assert_position(rev4, ob1b, true, 9.30, 9.35); assert(xornsch_set_pos_x(rev4, sel3, 9.40) == 0); assert_position(rev4, ob0, true, 9.40, 9.35); assert_position(rev4, ob1a, false, 0., 0.); assert_position(rev4, ob1b, true, 9.40, 9.35); assert(xornsch_set_pos_y(rev4, sel3, 9.45) == 0); assert_position(rev4, ob0, true, 9.40, 9.45); assert_position(rev4, ob1a, false, 0., 0.); assert_position(rev4, ob1b, true, 9.40, 9.45); memset(&text_data, 0, sizeof text_data); text_data.text.s = "Hello world"; text_data.text.len = 11; text_ob = xornsch_add_text(rev4, &text_data); assert(text_ob != NULL); text_sel = xorn_select_object(text_ob); assert(text_sel != NULL); assert_text(rev4, ob0, false, ""); assert_text(rev4, ob1a, false, ""); assert_text(rev4, ob1b, false, ""); assert_text(rev4, text_ob, true, "Hello world"); text_data.text.s = "dlrow olleH"; assert(xornsch_set_text(rev4, text_sel, &text_data.text) == 0); assert_text(rev4, ob0, false, ""); assert_text(rev4, ob1a, false, ""); assert_text(rev4, ob1b, false, ""); assert_text(rev4, text_ob, true, "dlrow olleH"); xorn_finalize_revision(rev4); rev5 = xorn_new_revision(rev2); assert(rev5 != NULL); memset(&line, 0, sizeof line); line.width = 10.; line.cap_style = 11; line.dash_style = 12; line.dash_length = 13.; line.dash_space = 14.; assert(xornsch_set_line(rev5, sel0, &line) == 0); assert_line(rev5, ob0, true, 1., 0, 0, 0., 0.); assert_line(rev5, ob1a, true, 1., 0, 0, 0., 0.); assert_line(rev5, ob1b, true, 1., 0, 0, 0., 0.); assert(xornsch_set_line(rev5, sel1, &line) == 0); assert_line(rev5, ob0, true, 10., 11, 12, 13., 14.); assert_line(rev5, ob1a, true, 1., 0, 0, 0., 0.); assert_line(rev5, ob1b, true, 1., 0, 0, 0., 0.); assert(xornsch_set_line(rev5, sel2, &line) == 0); assert_line(rev5, ob0, true, 10., 11, 12, 13., 14.); assert_line(rev5, ob1a, true, 10., 11, 12, 13., 14.); assert_line(rev5, ob1b, true, 10., 11, 12, 13., 14.); line.dash_space = 14.1; assert(xornsch_set_line(rev5, sel3, &line) == 0); assert_line(rev5, ob0, true, 10., 11, 12, 13., 14.1); assert_line(rev5, ob1a, true, 10., 11, 12, 13., 14.); assert_line(rev5, ob1b, true, 10., 11, 12, 13., 14.1); memset(&fill, 0, sizeof fill); fill.type = 20; fill.width = 21.; fill.angle0 = 22; fill.pitch0 = 23.; fill.angle1 = 24; fill.pitch1 = 25.; assert(xornsch_set_fill(rev5, sel0, &fill) == 0); assert_fill(rev5, ob0, false, 0, 0., 0, 0., 0, 0.); assert_fill(rev5, ob1a, true, 0, 0., 0, 0., 0, 0.); assert_fill(rev5, ob1b, true, 1, 0., 0, 0., 0, 0.); assert(xornsch_set_fill(rev5, sel1, &fill) == 0); assert_fill(rev5, ob0, false, 0, 0., 0, 0., 0, 0.); assert_fill(rev5, ob1a, true, 0, 0., 0, 0., 0, 0.); assert_fill(rev5, ob1b, true, 1, 0., 0, 0., 0, 0.); assert(xornsch_set_fill(rev5, sel2, &fill) == 0); assert_fill(rev5, ob0, false, 0, 0., 0, 0., 0, 0.); assert_fill(rev5, ob1a, true, 20, 21., 22, 23., 24, 25.); assert_fill(rev5, ob1b, true, 20, 21., 22, 23., 24, 25.); fill.pitch1 = 25.1; assert(xornsch_set_fill(rev5, sel3, &fill) == 0); assert_fill(rev5, ob0, false, 0, 0., 0, 0., 0, 0.); assert_fill(rev5, ob1a, true, 20, 21., 22, 23., 24, 25.); assert_fill(rev5, ob1b, true, 20, 21., 22, 23., 24, 25.1); xorn_finalize_revision(rev5); xorn_free_selection(text_sel); xorn_free_selection(sel3); xorn_free_selection(sel2); xorn_free_selection(sel1); xorn_free_selection(sel0); xorn_free_revision(rev5); xorn_free_revision(rev4); xorn_free_revision(rev3); xorn_free_revision(rev2); xorn_free_revision(rev1); xorn_free_revision(rev0); return 0; }
int main(void) { xorn_revision_t rev0, rev1, rev2, rev3; xorn_object_t ob0, ob1a, ob1b; xorn_selection_t sel, sel1, sel2; setup(&rev0, &rev1, &rev2, &rev3, &ob0, &ob1a, &ob1b); /* select none */ sel = xorn_select_none(); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_0(rev1, sel); assert_selected_objects_0(rev2, sel); assert_selected_objects_0(rev3, sel); xorn_free_selection(sel); /* select object */ sel = xorn_select_object(ob0); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_1(rev1, sel, ob0); assert_selected_objects_1(rev2, sel, ob0); assert_selected_objects_1(rev3, sel, ob0); xorn_free_selection(sel); sel = xorn_select_object(ob1a); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_0(rev1, sel); assert_selected_objects_1(rev2, sel, ob1a); assert_selected_objects_0(rev3, sel); xorn_free_selection(sel); sel = xorn_select_object(ob1b); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_0(rev1, sel); assert_selected_objects_1(rev2, sel, ob1b); assert_selected_objects_1(rev3, sel, ob1b); xorn_free_selection(sel); /* select all */ sel = xorn_select_all(rev0); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_0(rev1, sel); assert_selected_objects_0(rev2, sel); assert_selected_objects_0(rev3, sel); xorn_free_selection(sel); sel = xorn_select_all(rev1); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_1(rev1, sel, ob0); assert_selected_objects_1(rev2, sel, ob0); assert_selected_objects_1(rev3, sel, ob0); xorn_free_selection(sel); sel = xorn_select_all(rev2); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_1(rev1, sel, ob0); assert_selected_objects_3(rev2, sel, ob0, ob1a, ob1b); assert_selected_objects_2(rev3, sel, ob0, ob1b); xorn_free_selection(sel); sel = xorn_select_all(rev3); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_1(rev1, sel, ob0); assert_selected_objects_2(rev2, sel, ob0, ob1b); assert_selected_objects_2(rev3, sel, ob0, ob1b); xorn_free_selection(sel); /* select all except */ sel1 = xorn_select_none(); assert(sel1 != NULL); sel = xorn_select_all_except(rev0, sel1); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_0(rev1, sel); assert_selected_objects_0(rev2, sel); assert_selected_objects_0(rev3, sel); xorn_free_selection(sel); sel = xorn_select_all_except(rev1, sel1); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_1(rev1, sel, ob0); assert_selected_objects_1(rev2, sel, ob0); assert_selected_objects_1(rev3, sel, ob0); xorn_free_selection(sel); sel = xorn_select_all_except(rev2, sel1); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_1(rev1, sel, ob0); assert_selected_objects_3(rev2, sel, ob0, ob1a, ob1b); assert_selected_objects_2(rev3, sel, ob0, ob1b); xorn_free_selection(sel); sel = xorn_select_all_except(rev3, sel1); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_1(rev1, sel, ob0); assert_selected_objects_2(rev2, sel, ob0, ob1b); assert_selected_objects_2(rev3, sel, ob0, ob1b); xorn_free_selection(sel); xorn_free_selection(sel1); sel1 = xorn_select_object(ob0); assert(sel1 != NULL); sel = xorn_select_all_except(rev0, sel1); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_0(rev1, sel); assert_selected_objects_0(rev2, sel); assert_selected_objects_0(rev3, sel); xorn_free_selection(sel); sel = xorn_select_all_except(rev1, sel1); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_0(rev1, sel); assert_selected_objects_0(rev2, sel); assert_selected_objects_0(rev3, sel); xorn_free_selection(sel); sel = xorn_select_all_except(rev2, sel1); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_0(rev1, sel); assert_selected_objects_2(rev2, sel, ob1a, ob1b); assert_selected_objects_1(rev3, sel, ob1b); xorn_free_selection(sel); sel = xorn_select_all_except(rev3, sel1); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_0(rev1, sel); assert_selected_objects_1(rev2, sel, ob1b); assert_selected_objects_1(rev3, sel, ob1b); xorn_free_selection(sel); xorn_free_selection(sel1); sel1 = xorn_select_all(rev3); assert(sel1 != NULL); sel = xorn_select_all_except(rev0, sel1); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_0(rev1, sel); assert_selected_objects_0(rev2, sel); assert_selected_objects_0(rev3, sel); xorn_free_selection(sel); sel = xorn_select_all_except(rev1, sel1); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_0(rev1, sel); assert_selected_objects_0(rev2, sel); assert_selected_objects_0(rev3, sel); xorn_free_selection(sel); sel = xorn_select_all_except(rev2, sel1); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_0(rev1, sel); assert_selected_objects_1(rev2, sel, ob1a); assert_selected_objects_0(rev3, sel); xorn_free_selection(sel); sel = xorn_select_all_except(rev3, sel1); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_0(rev1, sel); assert_selected_objects_0(rev2, sel); assert_selected_objects_0(rev3, sel); xorn_free_selection(sel); xorn_free_selection(sel1); /* select including */ sel1 = xorn_select_all(rev3); assert(sel1 != NULL); sel = xorn_select_including(sel1, ob0); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_1(rev1, sel, ob0); assert_selected_objects_2(rev2, sel, ob0, ob1b); assert_selected_objects_2(rev3, sel, ob0, ob1b); xorn_free_selection(sel); sel = xorn_select_including(sel1, ob1a); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_1(rev1, sel, ob0); assert_selected_objects_3(rev2, sel, ob0, ob1a, ob1b); assert_selected_objects_2(rev3, sel, ob0, ob1b); xorn_free_selection(sel); sel = xorn_select_including(sel1, ob1b); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_1(rev1, sel, ob0); assert_selected_objects_2(rev2, sel, ob0, ob1b); assert_selected_objects_2(rev3, sel, ob0, ob1b); xorn_free_selection(sel); xorn_free_selection(sel1); /* select excluding */ sel1 = xorn_select_all(rev3); assert(sel1 != NULL); sel = xorn_select_excluding(sel1, ob0); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_0(rev1, sel); assert_selected_objects_1(rev2, sel, ob1b); assert_selected_objects_1(rev3, sel, ob1b); xorn_free_selection(sel); sel = xorn_select_excluding(sel1, ob1a); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_1(rev1, sel, ob0); assert_selected_objects_2(rev2, sel, ob0, ob1b); assert_selected_objects_2(rev3, sel, ob0, ob1b); xorn_free_selection(sel); sel = xorn_select_excluding(sel1, ob1b); assert(sel != NULL); assert_selected_objects_0(rev0, sel); assert_selected_objects_1(rev1, sel, ob0); assert_selected_objects_1(rev2, sel, ob0); assert_selected_objects_1(rev3, sel, ob0); xorn_free_selection(sel); xorn_free_selection(sel1); /* select union */ sel1 = xorn_select_all(rev1); assert(sel1 != NULL); sel2 = xorn_select_none(); assert(sel2 != NULL); sel = xorn_select_union(sel1, sel2); assert(sel != NULL); assert_selected_objects_1(rev2, sel, ob0); xorn_free_selection(sel); xorn_free_selection(sel2); sel2 = xorn_select_object(ob1a); assert(sel2 != NULL); sel = xorn_select_union(sel1, sel2); assert(sel != NULL); assert_selected_objects_2(rev2, sel, ob0, ob1a); xorn_free_selection(sel); xorn_free_selection(sel2); sel2 = xorn_select_all(rev2); assert(sel2 != NULL); sel = xorn_select_union(sel1, sel2); assert(sel != NULL); assert_selected_objects_3(rev2, sel, ob0, ob1a, ob1b); xorn_free_selection(sel); xorn_free_selection(sel2); sel2 = xorn_select_all(rev3); assert(sel2 != NULL); sel = xorn_select_union(sel1, sel2); assert(sel != NULL); assert_selected_objects_2(rev2, sel, ob0, ob1b); xorn_free_selection(sel); xorn_free_selection(sel2); sel2 = xorn_select_all_except(rev2, sel1); assert(sel2 != NULL); xorn_free_selection(sel1); sel1 = sel2; sel2 = xorn_select_none(); assert(sel2 != NULL); sel = xorn_select_union(sel1, sel2); assert(sel != NULL); assert_selected_objects_2(rev2, sel, ob1a, ob1b); xorn_free_selection(sel); xorn_free_selection(sel2); sel2 = xorn_select_object(ob1a); assert(sel2 != NULL); sel = xorn_select_union(sel1, sel2); assert(sel != NULL); assert_selected_objects_2(rev2, sel, ob1a, ob1b); xorn_free_selection(sel); xorn_free_selection(sel2); sel2 = xorn_select_all(rev2); assert(sel2 != NULL); sel = xorn_select_union(sel1, sel2); assert(sel != NULL); assert_selected_objects_3(rev2, sel, ob0, ob1a, ob1b); xorn_free_selection(sel); xorn_free_selection(sel2); sel2 = xorn_select_all(rev3); assert(sel2 != NULL); sel = xorn_select_union(sel1, sel2); assert(sel != NULL); assert_selected_objects_3(rev2, sel, ob0, ob1a, ob1b); xorn_free_selection(sel); xorn_free_selection(sel2); xorn_free_selection(sel1); /* select intersection */ sel1 = xorn_select_all(rev1); assert(sel1 != NULL); sel2 = xorn_select_none(); assert(sel2 != NULL); sel = xorn_select_intersection(sel1, sel2); assert(sel != NULL); assert_selected_objects_0(rev2, sel); xorn_free_selection(sel); xorn_free_selection(sel2); sel2 = xorn_select_object(ob1a); assert(sel2 != NULL); sel = xorn_select_intersection(sel1, sel2); assert(sel != NULL); assert_selected_objects_0(rev2, sel); xorn_free_selection(sel); xorn_free_selection(sel2); sel2 = xorn_select_all(rev2); assert(sel2 != NULL); sel = xorn_select_intersection(sel1, sel2); assert(sel != NULL); assert_selected_objects_1(rev2, sel, ob0); xorn_free_selection(sel); xorn_free_selection(sel2); sel2 = xorn_select_all(rev3); assert(sel2 != NULL); sel = xorn_select_intersection(sel1, sel2); assert(sel != NULL); assert_selected_objects_1(rev2, sel, ob0); xorn_free_selection(sel); xorn_free_selection(sel2); sel2 = xorn_select_all_except(rev2, sel1); assert(sel2 != NULL); xorn_free_selection(sel1); sel1 = sel2; sel2 = xorn_select_none(); assert(sel2 != NULL); sel = xorn_select_intersection(sel1, sel2); assert(sel != NULL); assert_selected_objects_0(rev2, sel); xorn_free_selection(sel); xorn_free_selection(sel2); sel2 = xorn_select_object(ob1a); assert(sel2 != NULL); sel = xorn_select_intersection(sel1, sel2); assert(sel != NULL); assert_selected_objects_1(rev2, sel, ob1a); xorn_free_selection(sel); xorn_free_selection(sel2); sel2 = xorn_select_all(rev2); assert(sel2 != NULL); sel = xorn_select_intersection(sel1, sel2); assert(sel != NULL); assert_selected_objects_2(rev2, sel, ob1a, ob1b); xorn_free_selection(sel); xorn_free_selection(sel2); sel2 = xorn_select_all(rev3); assert(sel2 != NULL); sel = xorn_select_intersection(sel1, sel2); assert(sel != NULL); assert_selected_objects_1(rev2, sel, ob1b); xorn_free_selection(sel); xorn_free_selection(sel2); xorn_free_selection(sel1); /* select difference */ sel1 = xorn_select_all(rev1); assert(sel1 != NULL); sel2 = xorn_select_none(); assert(sel2 != NULL); sel = xorn_select_difference(sel1, sel2); assert(sel != NULL); assert_selected_objects_1(rev2, sel, ob0); xorn_free_selection(sel); xorn_free_selection(sel2); sel2 = xorn_select_object(ob1a); assert(sel2 != NULL); sel = xorn_select_difference(sel1, sel2); assert(sel != NULL); assert_selected_objects_1(rev2, sel, ob0); xorn_free_selection(sel); xorn_free_selection(sel2); sel2 = xorn_select_all(rev2); assert(sel2 != NULL); sel = xorn_select_difference(sel1, sel2); assert(sel != NULL); assert_selected_objects_0(rev2, sel); xorn_free_selection(sel); xorn_free_selection(sel2); sel2 = xorn_select_all(rev3); assert(sel2 != NULL); sel = xorn_select_difference(sel1, sel2); assert(sel != NULL); assert_selected_objects_0(rev2, sel); xorn_free_selection(sel); xorn_free_selection(sel2); sel2 = xorn_select_all_except(rev2, sel1); assert(sel2 != NULL); xorn_free_selection(sel1); sel1 = sel2; sel2 = xorn_select_none(); assert(sel2 != NULL); sel = xorn_select_difference(sel1, sel2); assert(sel != NULL); assert_selected_objects_2(rev2, sel, ob1a, ob1b); xorn_free_selection(sel); xorn_free_selection(sel2); sel2 = xorn_select_object(ob1a); assert(sel2 != NULL); sel = xorn_select_difference(sel1, sel2); assert(sel != NULL); assert_selected_objects_1(rev2, sel, ob1b); xorn_free_selection(sel); xorn_free_selection(sel2); sel2 = xorn_select_all(rev2); assert(sel2 != NULL); sel = xorn_select_difference(sel1, sel2); assert(sel != NULL); assert_selected_objects_0(rev2, sel); xorn_free_selection(sel); xorn_free_selection(sel2); sel2 = xorn_select_all(rev3); assert(sel2 != NULL); sel = xorn_select_difference(sel1, sel2); assert(sel != NULL); assert_selected_objects_1(rev2, sel, ob1a); xorn_free_selection(sel); xorn_free_selection(sel2); xorn_free_selection(sel1); xorn_free_revision(rev3); xorn_free_revision(rev2); xorn_free_revision(rev1); xorn_free_revision(rev0); return 0; }