- src_def_port = bt_component_source_get_default_output_port(src);
- assert(src_def_port);
- sink_def_port = bt_component_sink_get_default_input_port(sink);
- assert(sink_def_port);
- conn = bt_graph_connect_ports(graph, src_def_port, sink_def_port);
- assert(conn);
- src_hello_port = bt_component_source_get_output_port(src, "hello");
- assert(src_hello_port);
-
- /* We're supposed to have 4 events */
- ok(events->len == 4, "we have the expected number of events");
+ BT_ASSERT(graph);
+ src = create_src(graph);
+ sink = create_sink(graph);
+ src_def_port = bt_component_source_get_output_port_by_name(src, "out");
+ BT_ASSERT(src_def_port);
+ sink_def_port = bt_component_sink_get_input_port_by_name(sink, "in");
+ BT_ASSERT(sink_def_port);
+ status = bt_graph_connect_ports(graph, src_def_port, sink_def_port,
+ &conn);
+ BT_ASSERT(status == 0);
+ src_hello_port = bt_component_source_get_output_port_by_name(src,
+ "hello");
+ BT_ASSERT(src_hello_port);
+
+ /* We're supposed to have 8 events */
+ ok(events->len == 8, "we have the expected number of events");
+
+ /* Source's port added */
+ event.type = GRAPH_PORT_ADDED;
+ event.data.graph_port_added.comp = src;
+ event.data.graph_port_added.port = src_def_port;
+ ok(has_event(&event), "got the expected graph's port added event (for source, initial)");
+
+ /* Sink's port added */
+ event.type = GRAPH_PORT_ADDED;
+ event.data.graph_port_added.comp = sink;
+ event.data.graph_port_added.port = sink_def_port;
+ ok(has_event(&event), "got the expected graph's port added event (for sink, initial)");