6 #include "libgeda_priv.h"
8 char const *connections_test_data
[] = {
10 "N 48200 45600 49300 45600 4",
11 "N 49300 45600 49300 46300 4",
15 static enum visit_result
update_object(OBJECT
*o
, void *userdata
)
17 PAGE
*page
= userdata
;
19 /* This would also be a place to emit page signals. */
20 s_conn_update_object(page
, o
);
29 OBJECT
*o_current
, *net1
, *net2
;
35 toplevel
= s_toplevel_new();
36 page
= s_page_new(toplevel
, "test");
37 s_toplevel_goto_page(toplevel
, page
);
39 buf
= g_strjoinv("\n", connections_test_data
);
40 o_read_buffer(toplevel
, toplevel
->page_current
->object_tail
,
41 buf
, strlen(buf
), "test");
44 s_visit_page(page
, &update_object
, page
, VISIT_ANY
, 1);
46 /* Basic sanity checks. */
47 o_current
= page
->object_head
->next
;
48 if (o_current
->type
!= OBJ_NET
) {
51 if (!o_current
->next
|| o_current
->next
->type
!= OBJ_NET
) {
55 net2
= o_current
->next
;
57 /* The real meat of this test: nets should be connected at first. */
59 if (!net1
->conn_list
|| g_list_length(net1
->conn_list
) != 1) {
63 conn
= net1
->conn_list
->data
;
64 if (conn
->other_object
!= net2
||
65 conn
->type
!= CONN_ENDPOINT
||
66 conn
->x
!= 49300 || conn
->y
!= 45600 ||
67 conn
->whichone
!= GRIP_2
||
68 conn
->other_whichone
!= GRIP_1
) {
72 if (!net2
->conn_list
|| g_list_length(net2
->conn_list
) != 1) {
75 conn
= net2
->conn_list
->data
;
76 if (conn
->other_object
!= net1
||
77 conn
->type
!= CONN_ENDPOINT
||
78 conn
->x
!= 49300 || conn
->y
!= 45600 ||
79 conn
->whichone
!= GRIP_1
||
80 conn
->other_whichone
!= GRIP_2
) {
84 /* And then the connection must break. */
85 s_basic_move_grip(net1
, GRIP_2
, 49200, 45600);
86 s_conn_update_object(page
, net1
);
88 if (net1
->conn_list
|| net2
->conn_list
) {