static void test_io_stream_properties (NiceAddress *addr) { NiceAgent *agent; guint stream_id; GIOStream *io_stream; GInputStream *input_stream; GOutputStream *output_stream; agent = nice_agent_new_reliable (NULL, NICE_COMPATIBILITY_RFC5245); nice_agent_add_local_address (agent, addr); stream_id = nice_agent_add_stream (agent, 1); /* Try building an I/O stream around it. */ io_stream = nice_agent_get_io_stream (agent, stream_id, 1); g_assert (G_IS_IO_STREAM (io_stream)); g_assert (NICE_IS_IO_STREAM (io_stream)); /* Check various initial properties. */ g_assert (!g_io_stream_is_closed (G_IO_STREAM (io_stream))); g_assert (!g_io_stream_has_pending (G_IO_STREAM (io_stream))); /* Check the input stream’s properties. */ input_stream = g_io_stream_get_input_stream (G_IO_STREAM (io_stream)); g_assert (G_IS_INPUT_STREAM (input_stream)); g_assert (NICE_IS_INPUT_STREAM (input_stream)); g_assert (!g_input_stream_is_closed (input_stream)); g_assert (!g_input_stream_has_pending (input_stream)); /* Check the output stream’s properties. */ output_stream = g_io_stream_get_output_stream (G_IO_STREAM (io_stream)); g_assert (G_IS_OUTPUT_STREAM (output_stream)); g_assert (NICE_IS_OUTPUT_STREAM (output_stream)); g_assert (!g_output_stream_is_closing (output_stream)); g_assert (!g_output_stream_is_closed (output_stream)); g_assert (!g_output_stream_has_pending (output_stream)); /* Remove the component and check that the I/O streams close. */ nice_agent_remove_stream (agent, stream_id); g_assert (g_io_stream_is_closed (G_IO_STREAM (io_stream))); g_assert (g_input_stream_is_closed (input_stream)); g_assert (g_output_stream_is_closed (output_stream)); g_object_unref (io_stream); g_object_unref (agent); }
static VALUE rg_has_pending_p(VALUE self) { return CBOOL2RVAL(g_io_stream_has_pending(_SELF(self))); }