[gnome-control-center/wip/benzea/ci: 21/28] tests/network: Use the same NMClient as the panel



commit 7ad5656c7722401ed65ca6c637055023f94150f3
Author: Benjamin Berg <bberg redhat com>
Date:   Thu May 24 18:26:32 2018 +0200

    tests/network: Use the same NMClient as the panel
    
    Doing so means we handle the same events as the panel. This probably
    makes no difference, but this way it is guaranteed we are not getting
    weird inconsistencies during testing.
    
    Also fixes a NMClient memory leak in the process.

 tests/network/test-network-panel.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/tests/network/test-network-panel.c b/tests/network/test-network-panel.c
index 53d2f4b6a..74252197d 100644
--- a/tests/network/test-network-panel.c
+++ b/tests/network/test-network-panel.c
@@ -66,6 +66,9 @@ fixture_set_up_empty (NetworkPanelFixture  *fixture,
   fixture->client = nm_client_new (NULL, &error);
   g_assert_no_error (error);
 
+  /* Insert into object storage so that we see the same events as the panel. */
+  cc_object_storage_add_object (CC_OBJECT_NMCLIENT, fixture->client);
+
   fixture->shell = GTK_WIDGET (cc_test_window_new ());
 
   fixture->panel = g_object_new (cc_network_panel_get_type (),
@@ -83,6 +86,7 @@ fixture_tear_down (NetworkPanelFixture  *fixture,
                    gconstpointer         user_data)
 {
   g_clear_object (&fixture->panel);
+  g_clear_object (&fixture->client);
   g_clear_pointer (&fixture->shell, gtk_widget_destroy);
 
   cc_object_storage_destroy ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]