From: Visarion Alexandru <viorel.visarion@xxxxxxxxx> --- tests/test-gconfig.c | 36 ++++++++++++++++++++++ .../xml/gconfig-domain-device-graphics-listen.xml | 7 +++++ 2 files changed, 43 insertions(+) create mode 100644 tests/xml/gconfig-domain-device-graphics-listen.xml diff --git a/tests/test-gconfig.c b/tests/test-gconfig.c index a26bb5f..28565e3 100644 --- a/tests/test-gconfig.c +++ b/tests/test-gconfig.c @@ -481,6 +481,40 @@ static void test_domain_device_graphics(void) g_object_unref(G_OBJECT(domain)); } +static void test_domain_device_graphics_listen(void) +{ + GVirConfigDomain *domain; + GVirConfigDomainGraphicsSpice *graphics = NULL; + + domain = gvir_config_domain_new(); + GList *listen_list = NULL; + + graphics = gvir_config_domain_graphics_spice_new(); + + /* listen address node */ + GVirConfigDomainGraphicsListenAddress *address_listen = gvir_config_domain_graphics_listen_address_new(); + GInetAddress *inet_address = g_inet_address_new_from_string("0.0.0.0"); + + gvir_config_domain_graphics_listen_address_set_inet_address(address_listen, inet_address); + GInetAddress *ret_inet_address = gvir_config_domain_graphics_listen_address_get_inet_address(address_listen); + g_assert_cmpstr(g_inet_address_to_string(inet_address), ==, g_inet_address_to_string(ret_inet_address)); + + gvir_config_domain_graphics_listen_address_set_address(address_listen, "127.0.0.1"); + const gchar *ret_address = gvir_config_domain_graphics_listen_address_get_address(address_listen); + g_assert_cmpstr("127.0.0.1", ==, ret_address); + + /* test listen setter */ + listen_list = g_list_append(listen_list, address_listen); + gvir_config_domain_graphics_spice_set_listen_devices(graphics, listen_list); + g_object_unref(G_OBJECT(address_listen)); + + gvir_config_domain_add_device(domain, GVIR_CONFIG_DOMAIN_DEVICE(graphics)); + g_object_unref(G_OBJECT(graphics)); + + check_xml(domain, "gconfig-domain-device-graphics-listen.xml"); + + g_object_unref(G_OBJECT(domain)); +} static void test_domain_device_video(void) { @@ -782,6 +816,8 @@ int main(int argc, char **argv) test_domain_device_usb_redir); g_test_add_func("/libvirt-gconfig/domain-device-pci-hostdev", test_domain_device_pci_hostdev); + g_test_add_func("/libvirt-gconfig/domain-device-graphics-listen", + test_domain_device_graphics_listen); return g_test_run(); } diff --git a/tests/xml/gconfig-domain-device-graphics-listen.xml b/tests/xml/gconfig-domain-device-graphics-listen.xml new file mode 100644 index 0000000..27200c4 --- /dev/null +++ b/tests/xml/gconfig-domain-device-graphics-listen.xml @@ -0,0 +1,7 @@ +<domain> + <devices> + <graphics type="spice"> + <listen type="address" address="127.0.0.1"/> + </graphics> + </devices> +</domain> -- 2.7.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list