[libhandy/msvc: 10/11] test/: Remove g_auto* usage
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy/msvc: 10/11] test/: Remove g_auto* usage
- Date: Wed, 25 May 2022 08:16:24 +0000 (UTC)
commit b27f850405b4d55e651f06bc60420257d5caa3a5
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Wed Apr 27 19:27:40 2022 +0800
test/: Remove g_auto* usage
This way, the test programs will also build in Visual Studio.
tests/test-action-row.c | 32 ++++++--
tests/test-application-window.c | 4 +-
tests/test-avatar.c | 37 ++++++---
tests/test-carousel-indicator-dots.c | 4 +-
tests/test-carousel-indicator-lines.c | 4 +-
tests/test-carousel.c | 24 ++++--
tests/test-combo-row.c | 12 ++-
tests/test-deck.c | 20 +++--
tests/test-expander-row.c | 28 +++++--
tests/test-flap.c | 56 +++++++++----
tests/test-header-bar.c | 40 +++++++---
tests/test-header-group.c | 14 +++-
tests/test-keypad.c | 37 ++++++---
tests/test-leaflet.c | 20 +++--
tests/test-preferences-group.c | 12 ++-
tests/test-preferences-page.c | 12 ++-
tests/test-preferences-row.c | 8 +-
tests/test-preferences-window.c | 4 +-
tests/test-search-bar.c | 16 +++-
tests/test-squeezer.c | 28 +++++--
tests/test-status-page.c | 18 +++--
tests/test-swipe-group.c | 10 ++-
tests/test-tab-bar.c | 34 +++++---
tests/test-tab-view.c | 143 ++++++++++++++++++++++++----------
tests/test-view-switcher-bar.c | 12 ++-
tests/test-view-switcher.c | 12 ++-
tests/test-window-handle.c | 4 +-
tests/test-window.c | 4 +-
28 files changed, 480 insertions(+), 169 deletions(-)
---
diff --git a/tests/test-action-row.c b/tests/test-action-row.c
index 2dd1d4ad..6e5b7f7c 100644
--- a/tests/test-action-row.c
+++ b/tests/test-action-row.c
@@ -18,7 +18,7 @@ activated_cb (GtkWidget *widget, gpointer data)
static void
test_hdy_action_row_add (void)
{
- g_autoptr (HdyActionRow) row = NULL;
+ HdyActionRow *row;
GtkWidget *sw;
row = g_object_ref_sink (HDY_ACTION_ROW (hdy_action_row_new ()));
@@ -28,13 +28,15 @@ test_hdy_action_row_add (void)
g_assert_nonnull (sw);
gtk_container_add (GTK_CONTAINER (row), sw);
+
+ g_object_unref (row);
}
static void
test_hdy_action_row_add_prefix (void)
{
- g_autoptr (HdyActionRow) row = NULL;
+ HdyActionRow *row;
GtkWidget *radio;
row = g_object_ref_sink (HDY_ACTION_ROW (hdy_action_row_new ()));
@@ -44,13 +46,15 @@ test_hdy_action_row_add_prefix (void)
g_assert_nonnull (radio);
hdy_action_row_add_prefix (row, radio);
+
+ g_object_unref (row);
}
static void
test_hdy_action_row_subtitle (void)
{
- g_autoptr (HdyActionRow) row = NULL;
+ HdyActionRow *row;
row = g_object_ref_sink (HDY_ACTION_ROW (hdy_action_row_new ()));
g_assert_nonnull (row);
@@ -59,13 +63,15 @@ test_hdy_action_row_subtitle (void)
hdy_action_row_set_subtitle (row, "Dummy subtitle");
g_assert_cmpstr (hdy_action_row_get_subtitle (row), ==, "Dummy subtitle");
+
+ g_object_unref (row);
}
static void
test_hdy_action_row_icon_name (void)
{
- g_autoptr (HdyActionRow) row = NULL;
+ HdyActionRow *row;
row = g_object_ref_sink (HDY_ACTION_ROW (hdy_action_row_new ()));
g_assert_nonnull (row);
@@ -74,13 +80,15 @@ test_hdy_action_row_icon_name (void)
hdy_action_row_set_icon_name (row, "dummy-icon-name");
g_assert_cmpstr (hdy_action_row_get_icon_name (row), ==, "dummy-icon-name");
+
+ g_object_unref (row);
}
static void
test_hdy_action_row_use_underline (void)
{
- g_autoptr (HdyActionRow) row = NULL;
+ HdyActionRow *row;
row = g_object_ref_sink (HDY_ACTION_ROW (hdy_action_row_new ()));
g_assert_nonnull (row);
@@ -92,13 +100,15 @@ test_hdy_action_row_use_underline (void)
hdy_action_row_set_use_underline (row, FALSE);
g_assert_false (hdy_action_row_get_use_underline (row));
+
+ g_object_unref (row);
}
static void
test_hdy_action_row_title_lines (void)
{
- g_autoptr (HdyActionRow) row = NULL;
+ HdyActionRow *row;
row = g_object_ref_sink (HDY_ACTION_ROW (hdy_action_row_new ()));
g_assert_nonnull (row);
@@ -113,13 +123,15 @@ test_hdy_action_row_title_lines (void)
hdy_action_row_set_title_lines (row, 0);
g_assert_cmpint (hdy_action_row_get_title_lines (row), ==, 0);
+
+ g_object_unref (row);
}
static void
test_hdy_action_row_subtitle_lines (void)
{
- g_autoptr (HdyActionRow) row = NULL;
+ HdyActionRow *row;
row = g_object_ref_sink (HDY_ACTION_ROW (hdy_action_row_new ()));
g_assert_nonnull (row);
@@ -134,13 +146,15 @@ test_hdy_action_row_subtitle_lines (void)
hdy_action_row_set_subtitle_lines (row, 0);
g_assert_cmpint (hdy_action_row_get_subtitle_lines (row), ==, 0);
+
+ g_object_unref (row);
}
static void
test_hdy_action_row_activate (void)
{
- g_autoptr (HdyActionRow) row = NULL;
+ HdyActionRow *row;
row = g_object_ref_sink (HDY_ACTION_ROW (hdy_action_row_new ()));
g_assert_nonnull (row);
@@ -150,6 +164,8 @@ test_hdy_action_row_activate (void)
hdy_action_row_activate (row);
g_assert_cmpint (activated, ==, 1);
+
+ g_object_unref (row);
}
diff --git a/tests/test-application-window.c b/tests/test-application-window.c
index acd298dc..9e64dabb 100644
--- a/tests/test-application-window.c
+++ b/tests/test-application-window.c
@@ -10,10 +10,12 @@
static void
test_hdy_application_window_new (void)
{
- g_autoptr (GtkWidget) window = NULL;
+ GtkWidget *window;
window = g_object_ref_sink (hdy_application_window_new ());
g_assert_nonnull (window);
+
+ g_object_unref (window);
}
diff --git a/tests/test-avatar.c b/tests/test-avatar.c
index 43f31718..80253aef 100644
--- a/tests/test-avatar.c
+++ b/tests/test-avatar.c
@@ -111,47 +111,55 @@ did_draw_something (GtkWidget *widget)
static void
test_hdy_avatar_generate (void)
{
- g_autoptr (GtkWidget) avatar = g_object_ref_sink (hdy_avatar_new (TEST_SIZE, "", TRUE));
+ GtkWidget *avatar = g_object_ref_sink (hdy_avatar_new (TEST_SIZE, "", TRUE));
g_assert (HDY_IS_AVATAR (avatar));
g_assert_true (did_draw_something (GTK_WIDGET (avatar)));
+
+ g_object_unref (avatar);
}
static void
test_hdy_avatar_icon_name (void)
{
- g_autoptr (HdyAvatar) avatar = g_object_ref_sink (HDY_AVATAR (hdy_avatar_new (128, NULL, TRUE)));
+ HdyAvatar *avatar = g_object_ref_sink (HDY_AVATAR (hdy_avatar_new (128, NULL, TRUE)));
g_assert_null (hdy_avatar_get_icon_name (avatar));
hdy_avatar_set_icon_name (avatar, TEST_ICON_NAME);
g_assert_cmpstr (hdy_avatar_get_icon_name (avatar), ==, TEST_ICON_NAME);
g_assert_true (did_draw_something (GTK_WIDGET (avatar)));
+
+ g_object_unref (avatar);
}
static void
test_hdy_avatar_text (void)
{
- g_autoptr (HdyAvatar) avatar = g_object_ref_sink (HDY_AVATAR (hdy_avatar_new (128, NULL, TRUE)));
+ HdyAvatar *avatar = g_object_ref_sink (HDY_AVATAR (hdy_avatar_new (128, NULL, TRUE)));
g_assert_null (hdy_avatar_get_text (avatar));
hdy_avatar_set_text (avatar, TEST_STRING);
g_assert_cmpstr (hdy_avatar_get_text (avatar), ==, TEST_STRING);
g_assert_true (did_draw_something (GTK_WIDGET (avatar)));
+
+ g_object_unref (avatar);
}
static void
test_hdy_avatar_size (void)
{
- g_autoptr (HdyAvatar) avatar = g_object_ref_sink (HDY_AVATAR (hdy_avatar_new (TEST_SIZE, NULL, TRUE)));
+ HdyAvatar *avatar = g_object_ref_sink (HDY_AVATAR (hdy_avatar_new (TEST_SIZE, NULL, TRUE)));
g_assert_cmpint (hdy_avatar_get_size (avatar), ==, TEST_SIZE);
hdy_avatar_set_size (avatar, TEST_SIZE / 2);
g_assert_cmpint (hdy_avatar_get_size (avatar), ==, TEST_SIZE / 2);
g_assert_true (did_draw_something (GTK_WIDGET (avatar)));
+
+ g_object_unref (avatar);
}
static void
@@ -204,8 +212,8 @@ test_hdy_avatar_custom_image (void)
static void
test_hdy_avatar_draw_to_pixbuf (void)
{
- g_autoptr (HdyAvatar) avatar = NULL;
- g_autoptr (GdkPixbuf) pixbuf = NULL;
+ HdyAvatar *avatar;
+ GdkPixbuf *pixbuf;
avatar = g_object_ref_sink (HDY_AVATAR (hdy_avatar_new (TEST_SIZE, NULL, TRUE)));
@@ -213,6 +221,9 @@ test_hdy_avatar_draw_to_pixbuf (void)
g_assert_cmpint (gdk_pixbuf_get_width (pixbuf), ==, TEST_SIZE * 2);
g_assert_cmpint (gdk_pixbuf_get_height (pixbuf), ==, TEST_SIZE * 2);
+
+ g_object_unref (pixbuf);
+ g_object_unref (avatar);
}
static void
@@ -220,16 +231,18 @@ draw_to_pixbuf_async (HdyAvatar *avatar,
GAsyncResult *res,
gpointer user_data)
{
- g_autoptr (GdkPixbuf) pixbuf = hdy_avatar_draw_to_pixbuf_finish (avatar, res);
+ GdkPixbuf *pixbuf = hdy_avatar_draw_to_pixbuf_finish (avatar, res);
g_assert_cmpint (gdk_pixbuf_get_width (pixbuf), ==, TEST_SIZE * 2);
g_assert_cmpint (gdk_pixbuf_get_height (pixbuf), ==, TEST_SIZE * 2);
+
+ g_object_unref (pixbuf);
}
static void
test_hdy_avatar_draw_to_pixbuf_async (void)
{
- g_autoptr (HdyAvatar) avatar = g_object_ref_sink (HDY_AVATAR (hdy_avatar_new (TEST_SIZE, NULL, TRUE)));
+ HdyAvatar *avatar = g_object_ref_sink (HDY_AVATAR (hdy_avatar_new (TEST_SIZE, NULL, TRUE)));
hdy_avatar_draw_to_pixbuf_async (avatar,
TEST_SIZE * 2,
@@ -237,13 +250,15 @@ test_hdy_avatar_draw_to_pixbuf_async (void)
NULL,
(GAsyncReadyCallback) draw_to_pixbuf_async,
NULL);
+
+ g_object_unref (avatar);
}
static void
test_hdy_avatar_loadable_icon (void)
{
- GtkWidget* avatar = NULL;
- g_autoptr (GdkPixbuf) pixbuf = NULL;
+ GtkWidget* avatar;
+ GdkPixbuf *pixbuf;
avatar = hdy_avatar_new (TEST_SIZE, NULL, TRUE);
g_assert_nonnull (avatar);
@@ -259,6 +274,8 @@ test_hdy_avatar_loadable_icon (void)
gdk_pixbuf_fill (pixbuf, 0);
hdy_avatar_set_loadable_icon (HDY_AVATAR (avatar), G_LOADABLE_ICON (pixbuf));
g_assert_false (did_draw_something (avatar));
+
+ g_object_unref (pixbuf);
g_object_unref (avatar);
}
diff --git a/tests/test-carousel-indicator-dots.c b/tests/test-carousel-indicator-dots.c
index e62b2472..cf18f373 100644
--- a/tests/test-carousel-indicator-dots.c
+++ b/tests/test-carousel-indicator-dots.c
@@ -17,7 +17,7 @@ notify_cb (GtkWidget *widget, gpointer data)
static void
test_hdy_carousel_indicator_dots_carousel (void)
{
- g_autoptr (HdyCarouselIndicatorDots) dots = NULL;
+ HdyCarouselIndicatorDots *dots;
HdyCarousel *carousel;
dots = g_object_ref_sink (HDY_CAROUSEL_INDICATOR_DOTS (hdy_carousel_indicator_dots_new ()));
@@ -39,6 +39,8 @@ test_hdy_carousel_indicator_dots_carousel (void)
hdy_carousel_indicator_dots_set_carousel (dots, NULL);
g_assert_null (hdy_carousel_indicator_dots_get_carousel (dots));
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (dots);
}
gint
diff --git a/tests/test-carousel-indicator-lines.c b/tests/test-carousel-indicator-lines.c
index 9e5ead90..a8895065 100644
--- a/tests/test-carousel-indicator-lines.c
+++ b/tests/test-carousel-indicator-lines.c
@@ -17,7 +17,7 @@ notify_cb (GtkWidget *widget, gpointer data)
static void
test_hdy_carousel_indicator_lines_carousel (void)
{
- g_autoptr (HdyCarouselIndicatorLines) lines = NULL;
+ HdyCarouselIndicatorLines *lines;
HdyCarousel *carousel;
lines = g_object_ref_sink (HDY_CAROUSEL_INDICATOR_LINES (hdy_carousel_indicator_lines_new ()));
@@ -39,6 +39,8 @@ test_hdy_carousel_indicator_lines_carousel (void)
hdy_carousel_indicator_lines_set_carousel (lines, NULL);
g_assert_null (hdy_carousel_indicator_lines_get_carousel (lines));
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (lines);
}
gint
diff --git a/tests/test-carousel.c b/tests/test-carousel.c
index 6f6d3e63..430b3424 100644
--- a/tests/test-carousel.c
+++ b/tests/test-carousel.c
@@ -101,7 +101,7 @@ test_hdy_carousel_scroll_to (void)
static void
test_hdy_carousel_interactive (void)
{
- g_autoptr (HdyCarousel) carousel = g_object_ref_sink (HDY_CAROUSEL (hdy_carousel_new ()));
+ HdyCarousel *carousel = g_object_ref_sink (HDY_CAROUSEL (hdy_carousel_new ()));
gboolean interactive;
notified = 0;
@@ -122,12 +122,14 @@ test_hdy_carousel_interactive (void)
/* Setting the same value should not notify */
hdy_carousel_set_interactive (carousel, TRUE);
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (carousel);
}
static void
test_hdy_carousel_spacing (void)
{
- g_autoptr (HdyCarousel) carousel = g_object_ref_sink (HDY_CAROUSEL (hdy_carousel_new ()));
+ HdyCarousel *carousel = g_object_ref_sink (HDY_CAROUSEL (hdy_carousel_new ()));
guint spacing;
notified = 0;
@@ -148,12 +150,14 @@ test_hdy_carousel_spacing (void)
/* Setting the same value should not notify */
hdy_carousel_set_spacing (carousel, 6);
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (carousel);
}
static void
test_hdy_carousel_animation_duration (void)
{
- g_autoptr (HdyCarousel) carousel = g_object_ref_sink (HDY_CAROUSEL (hdy_carousel_new ()));
+ HdyCarousel *carousel = g_object_ref_sink (HDY_CAROUSEL (hdy_carousel_new ()));
guint duration;
notified = 0;
@@ -174,12 +178,14 @@ test_hdy_carousel_animation_duration (void)
/* Setting the same value should not notify */
hdy_carousel_set_animation_duration (carousel, 500);
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (carousel);
}
static void
test_hdy_carousel_allow_mouse_drag (void)
{
- g_autoptr (HdyCarousel) carousel = g_object_ref_sink (HDY_CAROUSEL (hdy_carousel_new ()));
+ HdyCarousel *carousel = g_object_ref_sink (HDY_CAROUSEL (hdy_carousel_new ()));
gboolean allow_mouse_drag;
notified = 0;
@@ -200,12 +206,14 @@ test_hdy_carousel_allow_mouse_drag (void)
/* Setting the same value should not notify */
hdy_carousel_set_allow_mouse_drag (carousel, TRUE);
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (carousel);
}
static void
test_hdy_carousel_allow_long_swipes (void)
{
- g_autoptr (HdyCarousel) carousel = g_object_ref_sink (HDY_CAROUSEL (hdy_carousel_new ()));
+ HdyCarousel *carousel = g_object_ref_sink (HDY_CAROUSEL (hdy_carousel_new ()));
gboolean allow_long_swipes;
notified = 0;
@@ -226,12 +234,14 @@ test_hdy_carousel_allow_long_swipes (void)
/* Setting the same value should not notify */
hdy_carousel_set_allow_long_swipes (carousel, FALSE);
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (carousel);
}
static void
test_hdy_carousel_reveal_duration (void)
{
- g_autoptr (HdyCarousel) carousel = g_object_ref_sink (HDY_CAROUSEL (hdy_carousel_new ()));
+ HdyCarousel *carousel = g_object_ref_sink (HDY_CAROUSEL (hdy_carousel_new ()));
guint duration;
notified = 0;
@@ -252,6 +262,8 @@ test_hdy_carousel_reveal_duration (void)
/* Setting the same value should not notify */
hdy_carousel_set_reveal_duration (carousel, 500);
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (carousel);
}
gint
diff --git a/tests/test-combo-row.c b/tests/test-combo-row.c
index 0d7842fe..218f0be6 100644
--- a/tests/test-combo-row.c
+++ b/tests/test-combo-row.c
@@ -17,7 +17,7 @@ notify_cb (GtkWidget *widget, gpointer data)
static void
test_hdy_combo_row_set_for_enum (void)
{
- g_autoptr (HdyComboRow) row = NULL;
+ HdyComboRow *row;
GListModel *model;
HdyEnumValueObject *value;
@@ -39,12 +39,14 @@ test_hdy_combo_row_set_for_enum (void)
value = g_list_model_get_item (model, 1);
g_assert_true (HDY_IS_ENUM_VALUE_OBJECT (value));
g_assert_cmpstr (hdy_enum_value_object_get_nick (value), ==, "vertical");
+
+ g_object_unref (row);
}
static void
test_hdy_combo_row_selected_index (void)
{
- g_autoptr (HdyComboRow) row = NULL;
+ HdyComboRow *row;
gint selected_index = 0;
row = HDY_COMBO_ROW (g_object_ref_sink (hdy_combo_row_new ()));
@@ -70,12 +72,14 @@ test_hdy_combo_row_selected_index (void)
g_object_set (row, "selected-index", 1, NULL);
g_assert_cmpint (hdy_combo_row_get_selected_index (row), ==, 1);
g_assert_cmpint (notified, ==, 3);
+
+ g_object_unref (row);
}
static void
test_hdy_combo_row_use_subtitle (void)
{
- g_autoptr (HdyComboRow) row = NULL;
+ HdyComboRow *row;
gboolean use_subtitle = FALSE;
row = g_object_ref_sink (HDY_COMBO_ROW (hdy_combo_row_new ()));
@@ -97,6 +101,8 @@ test_hdy_combo_row_use_subtitle (void)
g_object_get (row, "use-subtitle", &use_subtitle, NULL);
g_assert_false (use_subtitle);
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (row);
}
diff --git a/tests/test-deck.c b/tests/test-deck.c
index 81827963..3aa8841e 100644
--- a/tests/test-deck.c
+++ b/tests/test-deck.c
@@ -10,7 +10,7 @@
static void
test_hdy_deck_adjacent_child (void)
{
- g_autoptr (HdyDeck) deck = NULL;
+ HdyDeck *deck;
GtkWidget *children[2];
gint i;
GtkWidget *result;
@@ -40,13 +40,15 @@ test_hdy_deck_adjacent_child (void)
result = hdy_deck_get_adjacent_child (deck, HDY_NAVIGATION_DIRECTION_FORWARD);
g_assert_null (result);
+
+ g_object_unref (deck);
}
static void
test_hdy_deck_navigate (void)
{
- g_autoptr (HdyDeck) deck = NULL;
+ HdyDeck *deck;
GtkWidget *children[2];
gint i;
gboolean result;
@@ -82,13 +84,15 @@ test_hdy_deck_navigate (void)
result = hdy_deck_navigate (deck, HDY_NAVIGATION_DIRECTION_BACK);
g_assert_true (result);
g_assert_true (hdy_deck_get_visible_child (deck) == children[0]);
+
+ g_object_unref (deck);
}
static void
test_hdy_deck_prepend (void)
{
- g_autoptr (HdyDeck) deck = NULL;
+ HdyDeck *deck;
GtkWidget *labels[2];
gint i;
GList *children = NULL;
@@ -111,13 +115,15 @@ test_hdy_deck_prepend (void)
g_assert_cmpint (g_list_index (children, labels[0]), ==, 0);
g_assert_cmpint (g_list_index (children, labels[1]), ==, 1);
g_list_free (children);
+
+ g_object_unref (deck);
}
static void
test_hdy_deck_insert_child_after (void)
{
- g_autoptr (HdyDeck) deck = NULL;
+ HdyDeck *deck;
GtkWidget *labels[3];
gint i;
GList *children = NULL;
@@ -144,13 +150,15 @@ test_hdy_deck_insert_child_after (void)
g_assert_cmpint (g_list_index (children, labels[1]), ==, 1);
g_assert_cmpint (g_list_index (children, labels[2]), ==, 2);
g_list_free (children);
+
+ g_object_unref (deck);
}
static void
test_hdy_deck_reorder_child_after (void)
{
- g_autoptr (HdyDeck) deck = NULL;
+ HdyDeck *deck;
GtkWidget *labels[3];
gint i;
GList *children = NULL;
@@ -184,6 +192,8 @@ test_hdy_deck_reorder_child_after (void)
g_assert_cmpint (g_list_index (children, labels[1]), ==, 1);
g_assert_cmpint (g_list_index (children, labels[0]), ==, 2);
g_list_free (children);
+
+ g_object_unref (deck);
}
diff --git a/tests/test-expander-row.c b/tests/test-expander-row.c
index 27cf82a3..941dffd8 100644
--- a/tests/test-expander-row.c
+++ b/tests/test-expander-row.c
@@ -10,7 +10,7 @@
static void
test_hdy_expander_row_add (void)
{
- g_autoptr (HdyExpanderRow) row = NULL;
+ HdyExpanderRow *row;
GtkWidget *sw;
row = g_object_ref_sink (HDY_EXPANDER_ROW (hdy_expander_row_new ()));
@@ -20,13 +20,15 @@ test_hdy_expander_row_add (void)
g_assert_nonnull (sw);
gtk_container_add (GTK_CONTAINER (row), sw);
+
+ g_object_unref (row);
}
static void
test_hdy_expander_row_subtitle (void)
{
- g_autoptr (HdyExpanderRow) row = NULL;
+ HdyExpanderRow *row;
row = g_object_ref_sink (HDY_EXPANDER_ROW (hdy_expander_row_new ()));
g_assert_nonnull (row);
@@ -35,13 +37,15 @@ test_hdy_expander_row_subtitle (void)
hdy_expander_row_set_subtitle (row, "Dummy subtitle");
g_assert_cmpstr (hdy_expander_row_get_subtitle (row), ==, "Dummy subtitle");
+
+ g_object_unref (row);
}
static void
test_hdy_expander_row_icon_name (void)
{
- g_autoptr (HdyExpanderRow) row = NULL;
+ HdyExpanderRow *row;
row = g_object_ref_sink (HDY_EXPANDER_ROW (hdy_expander_row_new ()));
g_assert_nonnull (row);
@@ -50,13 +54,15 @@ test_hdy_expander_row_icon_name (void)
hdy_expander_row_set_icon_name (row, "dummy-icon-name");
g_assert_cmpstr (hdy_expander_row_get_icon_name (row), ==, "dummy-icon-name");
+
+ g_object_unref (row);
}
static void
test_hdy_expander_row_use_undeline (void)
{
- g_autoptr (HdyExpanderRow) row = NULL;
+ HdyExpanderRow *row;
row = g_object_ref_sink (HDY_EXPANDER_ROW (hdy_expander_row_new ()));
g_assert_nonnull (row);
@@ -68,13 +74,15 @@ test_hdy_expander_row_use_undeline (void)
hdy_expander_row_set_use_underline (row, FALSE);
g_assert_false (hdy_expander_row_get_use_underline (row));
+
+ g_object_unref (row);
}
static void
test_hdy_expander_row_expanded (void)
{
- g_autoptr (HdyExpanderRow) row = NULL;
+ HdyExpanderRow *row;
row = g_object_ref_sink (HDY_EXPANDER_ROW (hdy_expander_row_new ()));
g_assert_nonnull (row);
@@ -86,13 +94,15 @@ test_hdy_expander_row_expanded (void)
hdy_expander_row_set_expanded (row, FALSE);
g_assert_false (hdy_expander_row_get_expanded (row));
+
+ g_object_unref (row);
}
static void
test_hdy_expander_row_enable_expansion (void)
{
- g_autoptr (HdyExpanderRow) row = NULL;
+ HdyExpanderRow *row;
row = g_object_ref_sink (HDY_EXPANDER_ROW (hdy_expander_row_new ()));
g_assert_nonnull (row);
@@ -113,13 +123,15 @@ test_hdy_expander_row_enable_expansion (void)
hdy_expander_row_set_enable_expansion (row, TRUE);
g_assert_true (hdy_expander_row_get_enable_expansion (row));
g_assert_true (hdy_expander_row_get_expanded (row));
+
+ g_object_unref (row);
}
static void
test_hdy_expander_row_show_enable_switch (void)
{
- g_autoptr (HdyExpanderRow) row = NULL;
+ HdyExpanderRow *row;
row = g_object_ref_sink (HDY_EXPANDER_ROW (hdy_expander_row_new ()));
g_assert_nonnull (row);
@@ -131,6 +143,8 @@ test_hdy_expander_row_show_enable_switch (void)
hdy_expander_row_set_show_enable_switch (row, FALSE);
g_assert_false (hdy_expander_row_get_show_enable_switch (row));
+
+ g_object_unref (row);
}
diff --git a/tests/test-flap.c b/tests/test-flap.c
index e6cc6576..6fcf2a9a 100644
--- a/tests/test-flap.c
+++ b/tests/test-flap.c
@@ -19,7 +19,7 @@ notify_cb (GtkWidget *widget, gpointer data)
static void
test_hdy_flap_flap (void)
{
- g_autoptr (HdyFlap) flap = NULL;
+ HdyFlap *flap;
GtkWidget *widget = NULL;
flap = g_object_ref_sink (HDY_FLAP (hdy_flap_new ()));
@@ -42,12 +42,14 @@ test_hdy_flap_flap (void)
g_object_set (flap, "flap", NULL, NULL);
g_assert_null (hdy_flap_get_flap (flap));
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (flap);
}
static void
test_hdy_flap_separator (void)
{
- g_autoptr (HdyFlap) flap = NULL;
+ HdyFlap *flap;
GtkWidget *widget = NULL;
flap = g_object_ref_sink (HDY_FLAP (hdy_flap_new ()));
@@ -70,12 +72,14 @@ test_hdy_flap_separator (void)
g_object_set (flap, "separator", NULL, NULL);
g_assert_null (hdy_flap_get_separator (flap));
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (flap);
}
static void
test_hdy_flap_flap_position (void)
{
- g_autoptr (HdyFlap) flap = NULL;
+ HdyFlap *flap;
GtkPackType position;
flap = g_object_ref_sink (HDY_FLAP (hdy_flap_new ()));
@@ -97,12 +101,14 @@ test_hdy_flap_flap_position (void)
g_object_set (flap, "flap-position", GTK_PACK_START, NULL);
g_assert_cmpint (hdy_flap_get_flap_position (flap), ==, GTK_PACK_START);
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (flap);
}
static void
test_hdy_flap_reveal_flap (void)
{
- g_autoptr (HdyFlap) flap = NULL;
+ HdyFlap *flap;
gboolean reveal;
flap = g_object_ref_sink (HDY_FLAP (hdy_flap_new ()));
@@ -126,12 +132,14 @@ test_hdy_flap_reveal_flap (void)
g_object_set (flap, "reveal-flap", TRUE, NULL);
g_assert_true (hdy_flap_get_reveal_flap (flap));
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (flap);
}
static void
test_hdy_flap_reveal_duration (void)
{
- g_autoptr (HdyFlap) flap = NULL;
+ HdyFlap *flap;
guint duration;
flap = g_object_ref_sink (HDY_FLAP (hdy_flap_new ()));
@@ -153,12 +161,14 @@ test_hdy_flap_reveal_duration (void)
g_object_set (flap, "reveal-duration", 100, NULL);
g_assert_cmpint (hdy_flap_get_reveal_duration (flap), ==, 100);
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (flap);
}
static void
test_hdy_flap_reveal_progress (void)
{
- g_autoptr (HdyFlap) flap = NULL;
+ HdyFlap *flap;
gdouble progress;
flap = g_object_ref_sink (HDY_FLAP (hdy_flap_new ()));
@@ -177,12 +187,14 @@ test_hdy_flap_reveal_progress (void)
hdy_flap_set_reveal_flap (flap, TRUE);
g_assert_cmpint (hdy_flap_get_reveal_progress (flap), ==, 1.0);
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (flap);
}
static void
test_hdy_flap_fold_policy (void)
{
- g_autoptr (HdyFlap) flap = NULL;
+ HdyFlap *flap;
HdyFlapFoldPolicy policy;
flap = g_object_ref_sink (HDY_FLAP (hdy_flap_new ()));
@@ -204,12 +216,14 @@ test_hdy_flap_fold_policy (void)
g_object_set (flap, "fold-policy", HDY_FLAP_FOLD_POLICY_ALWAYS, NULL);
g_assert_cmpint (hdy_flap_get_fold_policy (flap), ==, HDY_FLAP_FOLD_POLICY_ALWAYS);
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (flap);
}
static void
test_hdy_flap_fold_duration (void)
{
- g_autoptr (HdyFlap) flap = NULL;
+ HdyFlap *flap;
guint duration;
flap = g_object_ref_sink (HDY_FLAP (hdy_flap_new ()));
@@ -231,12 +245,14 @@ test_hdy_flap_fold_duration (void)
g_object_set (flap, "fold-duration", 100, NULL);
g_assert_cmpint (hdy_flap_get_fold_duration (flap), ==, 100);
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (flap);
}
static void
test_hdy_flap_folded (void)
{
- g_autoptr (HdyFlap) flap = NULL;
+ HdyFlap *flap;
gboolean folded;
flap = g_object_ref_sink (HDY_FLAP (hdy_flap_new ()));
@@ -254,12 +270,14 @@ test_hdy_flap_folded (void)
hdy_flap_set_fold_policy (flap, HDY_FLAP_FOLD_POLICY_ALWAYS);
g_assert_true (hdy_flap_get_folded (flap));
g_assert_cmpint (notified, ==, 1);
+
+ g_object_unref (flap);
}
static void
test_hdy_flap_locked (void)
{
- g_autoptr (HdyFlap) flap = NULL;
+ HdyFlap *flap;
gboolean locked;
flap = g_object_ref_sink (HDY_FLAP (hdy_flap_new ()));
@@ -283,12 +301,14 @@ test_hdy_flap_locked (void)
g_object_set (flap, "locked", FALSE, NULL);
g_assert_false (hdy_flap_get_locked (flap));
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (flap);
}
static void
test_hdy_flap_transition_type (void)
{
- g_autoptr (HdyFlap) flap = NULL;
+ HdyFlap *flap;
HdyFlapTransitionType policy;
flap = g_object_ref_sink (HDY_FLAP (hdy_flap_new ()));
@@ -310,12 +330,14 @@ test_hdy_flap_transition_type (void)
g_object_set (flap, "transition-type", HDY_FLAP_TRANSITION_TYPE_UNDER, NULL);
g_assert_cmpint (hdy_flap_get_transition_type (flap), ==, HDY_FLAP_TRANSITION_TYPE_UNDER);
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (flap);
}
static void
test_hdy_flap_modal (void)
{
- g_autoptr (HdyFlap) flap = NULL;
+ HdyFlap *flap;
gboolean modal;
flap = g_object_ref_sink (HDY_FLAP (hdy_flap_new ()));
@@ -339,12 +361,14 @@ test_hdy_flap_modal (void)
g_object_set (flap, "modal", TRUE, NULL);
g_assert_true (hdy_flap_get_modal (flap));
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (flap);
}
static void
test_hdy_flap_swipe_to_open (void)
{
- g_autoptr (HdyFlap) flap = NULL;
+ HdyFlap *flap;
gboolean swipe_to_open;
flap = g_object_ref_sink (HDY_FLAP (hdy_flap_new ()));
@@ -368,12 +392,14 @@ test_hdy_flap_swipe_to_open (void)
g_object_set (flap, "swipe-to-open", TRUE, NULL);
g_assert_true (hdy_flap_get_swipe_to_open (flap));
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (flap);
}
static void
test_hdy_flap_swipe_to_close (void)
{
- g_autoptr (HdyFlap) flap = NULL;
+ HdyFlap *flap;
gboolean swipe_to_close;
flap = g_object_ref_sink (HDY_FLAP (hdy_flap_new ()));
@@ -397,6 +423,8 @@ test_hdy_flap_swipe_to_close (void)
g_object_set (flap, "swipe-to-close", TRUE, NULL);
g_assert_true (hdy_flap_get_swipe_to_close (flap));
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (flap);
}
gint
diff --git a/tests/test-header-bar.c b/tests/test-header-bar.c
index 05ca8304..d3f4b1b6 100644
--- a/tests/test-header-bar.c
+++ b/tests/test-header-bar.c
@@ -10,7 +10,7 @@
static void
test_hdy_header_bar_pack (void)
{
- g_autoptr (HdyHeaderBar) bar = NULL;
+ HdyHeaderBar *bar;
GtkWidget *widget;
bar = g_object_ref_sink (HDY_HEADER_BAR (hdy_header_bar_new ()));
@@ -25,13 +25,15 @@ test_hdy_header_bar_pack (void)
g_assert_nonnull (widget);
hdy_header_bar_pack_end (bar, widget);
+
+ g_object_unref (bar);
}
static void
test_hdy_header_bar_title (void)
{
- g_autoptr (HdyHeaderBar) bar = NULL;
+ HdyHeaderBar *bar;
bar = g_object_ref_sink (HDY_HEADER_BAR (hdy_header_bar_new ()));
g_assert_nonnull (bar);
@@ -43,13 +45,15 @@ test_hdy_header_bar_title (void)
hdy_header_bar_set_title (bar, NULL);
g_assert_null (hdy_header_bar_get_title (bar));
+
+ g_object_unref (bar);
}
static void
test_hdy_header_bar_subtitle (void)
{
- g_autoptr (HdyHeaderBar) bar = NULL;
+ HdyHeaderBar *bar;
bar = g_object_ref_sink (HDY_HEADER_BAR (hdy_header_bar_new ()));
g_assert_nonnull (bar);
@@ -61,13 +65,15 @@ test_hdy_header_bar_subtitle (void)
hdy_header_bar_set_subtitle (bar, NULL);
g_assert_null (hdy_header_bar_get_subtitle (bar));
+
+ g_object_unref (bar);
}
static void
test_hdy_header_bar_custom_title (void)
{
- g_autoptr (HdyHeaderBar) bar = NULL;
+ HdyHeaderBar *bar;
GtkWidget *widget;
bar = g_object_ref_sink (HDY_HEADER_BAR (hdy_header_bar_new ()));
@@ -82,13 +88,15 @@ test_hdy_header_bar_custom_title (void)
hdy_header_bar_set_custom_title (bar, NULL);
g_assert_null (hdy_header_bar_get_custom_title (bar));
+
+ g_object_unref (bar);
}
static void
test_hdy_header_bar_show_close_button (void)
{
- g_autoptr (HdyHeaderBar) bar = NULL;
+ HdyHeaderBar *bar;
bar = g_object_ref_sink (HDY_HEADER_BAR (hdy_header_bar_new ()));
g_assert_nonnull (bar);
@@ -100,13 +108,15 @@ test_hdy_header_bar_show_close_button (void)
hdy_header_bar_set_show_close_button (bar, FALSE);
g_assert_false (hdy_header_bar_get_show_close_button (bar));
+
+ g_object_unref (bar);
}
static void
test_hdy_header_bar_has_subtitle (void)
{
- g_autoptr (HdyHeaderBar) bar = NULL;
+ HdyHeaderBar *bar;
bar = g_object_ref_sink (HDY_HEADER_BAR (hdy_header_bar_new ()));
g_assert_nonnull (bar);
@@ -118,13 +128,15 @@ test_hdy_header_bar_has_subtitle (void)
hdy_header_bar_set_has_subtitle (bar, TRUE);
g_assert_true (hdy_header_bar_get_has_subtitle (bar));
+
+ g_object_unref (bar);
}
static void
test_hdy_header_bar_decoration_layout (void)
{
- g_autoptr (HdyHeaderBar) bar = NULL;
+ HdyHeaderBar *bar;
bar = g_object_ref_sink (HDY_HEADER_BAR (hdy_header_bar_new ()));
g_assert_nonnull (bar);
@@ -136,13 +148,15 @@ test_hdy_header_bar_decoration_layout (void)
hdy_header_bar_set_decoration_layout (bar, NULL);
g_assert_null (hdy_header_bar_get_decoration_layout (bar));
+
+ g_object_unref (bar);
}
static void
test_hdy_header_bar_centering_policy (void)
{
- g_autoptr (HdyHeaderBar) bar = NULL;
+ HdyHeaderBar *bar;
bar = g_object_ref_sink (HDY_HEADER_BAR (hdy_header_bar_new ()));
g_assert_nonnull (bar);
@@ -154,13 +168,15 @@ test_hdy_header_bar_centering_policy (void)
hdy_header_bar_set_centering_policy (bar, HDY_CENTERING_POLICY_LOOSE);
g_assert_cmpint (hdy_header_bar_get_centering_policy (bar), ==, HDY_CENTERING_POLICY_LOOSE);
+
+ g_object_unref (bar);
}
static void
test_hdy_header_bar_transition_duration (void)
{
- g_autoptr (HdyHeaderBar) bar = NULL;
+ HdyHeaderBar *bar;
bar = g_object_ref_sink (HDY_HEADER_BAR (hdy_header_bar_new ()));
g_assert_nonnull (bar);
@@ -172,13 +188,15 @@ test_hdy_header_bar_transition_duration (void)
hdy_header_bar_set_transition_duration (bar, 1000);
g_assert_cmpuint (hdy_header_bar_get_transition_duration (bar), ==, 1000);
+
+ g_object_unref (bar);
}
static void
test_hdy_header_bar_interpolate_size (void)
{
- g_autoptr (HdyHeaderBar) bar = NULL;
+ HdyHeaderBar *bar;
bar = g_object_ref_sink (HDY_HEADER_BAR (hdy_header_bar_new ()));
g_assert_nonnull (bar);
@@ -190,6 +208,8 @@ test_hdy_header_bar_interpolate_size (void)
hdy_header_bar_set_interpolate_size (bar, FALSE);
g_assert_false (hdy_header_bar_get_interpolate_size (bar));
+
+ g_object_unref (bar);
}
diff --git a/tests/test-header-group.c b/tests/test-header-group.c
index 7ea8ae7f..e24247fa 100644
--- a/tests/test-header-group.c
+++ b/tests/test-header-group.c
@@ -10,7 +10,7 @@
static void
test_hdy_header_group_decorate_all (void)
{
- g_autoptr (HdyHeaderGroup) hg = HDY_HEADER_GROUP (hdy_header_group_new ());
+ HdyHeaderGroup *hg = HDY_HEADER_GROUP (hdy_header_group_new ());
gboolean decorate_all = FALSE;
g_assert_false (hdy_header_group_get_decorate_all (hg));
@@ -28,15 +28,17 @@ test_hdy_header_group_decorate_all (void)
g_assert_false (hdy_header_group_get_decorate_all (hg));
g_object_get (hg, "decorate-all", &decorate_all, NULL);
g_assert_false (decorate_all);
+
+ g_object_unref (hg);
}
static void
test_hdy_header_group_add_remove (void)
{
- g_autoptr (HdyHeaderGroup) hg = HDY_HEADER_GROUP (hdy_header_group_new ());
- g_autoptr (HdyHeaderBar) bar1 = HDY_HEADER_BAR (g_object_ref_sink (hdy_header_bar_new ()));
- g_autoptr (GtkHeaderBar) bar2 = GTK_HEADER_BAR (g_object_ref_sink (gtk_header_bar_new ()));
+ HdyHeaderGroup *hg = HDY_HEADER_GROUP (hdy_header_group_new ());
+ HdyHeaderBar *bar1 = HDY_HEADER_BAR (g_object_ref_sink (hdy_header_bar_new ()));
+ GtkHeaderBar *bar2 = GTK_HEADER_BAR (g_object_ref_sink (gtk_header_bar_new ()));
g_assert_cmpint (g_slist_length (hdy_header_group_get_children (hg)), ==, 0);
@@ -52,6 +54,10 @@ test_hdy_header_group_add_remove (void)
hdy_header_group_remove_header_bar (hg, bar1);
g_assert_cmpint (g_slist_length (hdy_header_group_get_children (hg)), ==, 0);
+
+ g_object_unref (bar2);
+ g_object_unref (bar1);
+ g_object_unref (hg);
}
diff --git a/tests/test-keypad.c b/tests/test-keypad.c
index 69ae6c1b..7f011a3e 100644
--- a/tests/test-keypad.c
+++ b/tests/test-keypad.c
@@ -20,7 +20,7 @@ notify_cb (GtkWidget *widget,
static void
test_hdy_keypad_row_spacing (void)
{
- g_autoptr (HdyKeypad) keypad = NULL;
+ HdyKeypad *keypad;
guint row_spacing = 0;
keypad = g_object_ref_sink (HDY_KEYPAD (hdy_keypad_new (FALSE, TRUE)));
@@ -47,13 +47,15 @@ test_hdy_keypad_row_spacing (void)
g_assert_cmpuint (row_spacing, ==, 12);
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (keypad);
}
static void
test_hdy_keypad_column_spacing (void)
{
- g_autoptr (HdyKeypad) keypad = NULL;
+ HdyKeypad *keypad;
guint column_spacing = 0;
keypad = g_object_ref_sink (HDY_KEYPAD (hdy_keypad_new (FALSE, TRUE)));
@@ -80,13 +82,15 @@ test_hdy_keypad_column_spacing (void)
g_assert_cmpuint (column_spacing, ==, 12);
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (keypad);
}
static void
test_hdy_keypad_letters_visible (void)
{
- g_autoptr (HdyKeypad) keypad = NULL;
+ HdyKeypad *keypad;
gboolean letters_visible = FALSE;
keypad = g_object_ref_sink (HDY_KEYPAD (hdy_keypad_new (FALSE, TRUE)));
@@ -113,13 +117,15 @@ test_hdy_keypad_letters_visible (void)
g_assert_true (letters_visible);
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (keypad);
}
static void
test_hdy_keypad_symbols_visible (void)
{
- g_autoptr (HdyKeypad) keypad = NULL;
+ HdyKeypad *keypad;
gboolean symbols_visible = TRUE;
keypad = g_object_ref_sink (HDY_KEYPAD (hdy_keypad_new (FALSE, TRUE)));
@@ -146,14 +152,16 @@ test_hdy_keypad_symbols_visible (void)
g_assert_false (symbols_visible);
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (keypad);
}
static void
test_hdy_keypad_entry (void)
{
- g_autoptr (HdyKeypad) keypad = NULL;
- g_autoptr (GtkEntry) entry = NULL;
+ HdyKeypad *keypad;
+ GtkEntry *entry;
keypad = g_object_ref_sink (HDY_KEYPAD (hdy_keypad_new (FALSE, TRUE)));
entry = g_object_ref_sink (GTK_ENTRY (gtk_entry_new ()));
@@ -172,14 +180,17 @@ test_hdy_keypad_entry (void)
g_assert_cmpint (notified, ==, 2);
g_assert_null (hdy_keypad_get_entry (keypad));
+
+ g_object_unref (entry);
+ g_object_unref (keypad);
}
static void
test_hdy_keypad_start_action (void)
{
- g_autoptr (HdyKeypad) keypad = NULL;
- g_autoptr (GtkWidget) button = NULL;
+ HdyKeypad *keypad;
+ GtkWidget *button;
keypad = g_object_ref_sink (HDY_KEYPAD (hdy_keypad_new (FALSE, TRUE)));
button = g_object_ref_sink (gtk_button_new ());
@@ -198,14 +209,17 @@ test_hdy_keypad_start_action (void)
g_assert_cmpint (notified, ==, 2);
g_assert_null (hdy_keypad_get_start_action (keypad));
+
+ g_object_unref (button);
+ g_object_unref (keypad);
}
static void
test_hdy_keypad_end_action (void)
{
- g_autoptr (HdyKeypad) keypad = NULL;
- g_autoptr (GtkWidget) button = NULL;
+ HdyKeypad *keypad;
+ GtkWidget *button;
keypad = g_object_ref_sink (HDY_KEYPAD (hdy_keypad_new (FALSE, TRUE)));
button = g_object_ref_sink (gtk_button_new ());
@@ -224,6 +238,9 @@ test_hdy_keypad_end_action (void)
g_assert_cmpint (notified, ==, 2);
g_assert_null (hdy_keypad_get_end_action (keypad));
+
+ g_object_unref (button);
+ g_object_unref (keypad);
}
diff --git a/tests/test-leaflet.c b/tests/test-leaflet.c
index deb0e23d..20142c41 100644
--- a/tests/test-leaflet.c
+++ b/tests/test-leaflet.c
@@ -10,7 +10,7 @@
static void
test_hdy_leaflet_adjacent_child (void)
{
- g_autoptr (HdyLeaflet) leaflet = NULL;
+ HdyLeaflet *leaflet;
GtkWidget *children[3];
gint i;
GtkWidget *result;
@@ -52,13 +52,15 @@ test_hdy_leaflet_adjacent_child (void)
result = hdy_leaflet_get_adjacent_child (leaflet, HDY_NAVIGATION_DIRECTION_FORWARD);
g_assert_null (result);
+
+ g_object_unref (leaflet);
}
static void
test_hdy_leaflet_navigate (void)
{
- g_autoptr (HdyLeaflet) leaflet = NULL;
+ HdyLeaflet *leaflet;
GtkWidget *children[3];
gint i;
gboolean result;
@@ -98,13 +100,15 @@ test_hdy_leaflet_navigate (void)
result = hdy_leaflet_navigate (leaflet, HDY_NAVIGATION_DIRECTION_BACK);
g_assert_true (result);
g_assert_true (hdy_leaflet_get_visible_child (leaflet) == children[0]);
+
+ g_object_unref (leaflet);
}
static void
test_hdy_leaflet_prepend (void)
{
- g_autoptr (HdyLeaflet) leaflet = NULL;
+ HdyLeaflet *leaflet;
GtkWidget *labels[2];
gint i;
GList *children = NULL;
@@ -127,13 +131,15 @@ test_hdy_leaflet_prepend (void)
g_assert_cmpint (g_list_index (children, labels[0]), ==, 0);
g_assert_cmpint (g_list_index (children, labels[1]), ==, 1);
g_list_free (children);
+
+ g_object_unref (leaflet);
}
static void
test_hdy_leaflet_insert_child_after (void)
{
- g_autoptr (HdyLeaflet) leaflet = NULL;
+ HdyLeaflet *leaflet;
GtkWidget *labels[3];
gint i;
GList *children = NULL;
@@ -160,13 +166,15 @@ test_hdy_leaflet_insert_child_after (void)
g_assert_cmpint (g_list_index (children, labels[1]), ==, 1);
g_assert_cmpint (g_list_index (children, labels[2]), ==, 2);
g_list_free (children);
+
+ g_object_unref (leaflet);
}
static void
test_hdy_leaflet_reorder_child_after (void)
{
- g_autoptr (HdyLeaflet) leaflet = NULL;
+ HdyLeaflet *leaflet;
GtkWidget *labels[3];
gint i;
GList *children = NULL;
@@ -200,6 +208,8 @@ test_hdy_leaflet_reorder_child_after (void)
g_assert_cmpint (g_list_index (children, labels[1]), ==, 1);
g_assert_cmpint (g_list_index (children, labels[0]), ==, 2);
g_list_free (children);
+
+ g_object_unref (leaflet);
}
diff --git a/tests/test-preferences-group.c b/tests/test-preferences-group.c
index 3682142f..c658cab0 100644
--- a/tests/test-preferences-group.c
+++ b/tests/test-preferences-group.c
@@ -10,7 +10,7 @@
static void
test_hdy_preferences_group_add (void)
{
- g_autoptr (HdyPreferencesGroup) group = NULL;
+ HdyPreferencesGroup *group;
HdyPreferencesRow *row;
GtkWidget *widget;
@@ -27,13 +27,15 @@ test_hdy_preferences_group_add (void)
g_assert (G_TYPE_CHECK_INSTANCE_TYPE (gtk_widget_get_parent (GTK_WIDGET (row)), GTK_TYPE_LIST_BOX));
g_assert (G_TYPE_CHECK_INSTANCE_TYPE (gtk_widget_get_parent (widget), GTK_TYPE_BOX));
+
+ g_object_unref (group);
}
static void
test_hdy_preferences_group_title (void)
{
- g_autoptr (HdyPreferencesGroup) group = NULL;
+ HdyPreferencesGroup *group;
group = g_object_ref_sink (HDY_PREFERENCES_GROUP (hdy_preferences_group_new ()));
g_assert_nonnull (group);
@@ -45,13 +47,15 @@ test_hdy_preferences_group_title (void)
hdy_preferences_group_set_title (group, NULL);
g_assert_cmpstr (hdy_preferences_group_get_title (group), ==, "");
+
+ g_object_unref (group);
}
static void
test_hdy_preferences_group_description (void)
{
- g_autoptr (HdyPreferencesGroup) group = NULL;
+ HdyPreferencesGroup *group;
group = g_object_ref_sink (HDY_PREFERENCES_GROUP (hdy_preferences_group_new ()));
g_assert_nonnull (group);
@@ -63,6 +67,8 @@ test_hdy_preferences_group_description (void)
hdy_preferences_group_set_description (group, NULL);
g_assert_cmpstr (hdy_preferences_group_get_description (group), ==, "");
+
+ g_object_unref (group);
}
diff --git a/tests/test-preferences-page.c b/tests/test-preferences-page.c
index a06e51f8..e08c89a9 100644
--- a/tests/test-preferences-page.c
+++ b/tests/test-preferences-page.c
@@ -10,7 +10,7 @@
static void
test_hdy_preferences_page_add (void)
{
- g_autoptr (HdyPreferencesPage) page = NULL;
+ HdyPreferencesPage *page;
HdyPreferencesGroup *group;
GtkWidget *widget;
@@ -26,13 +26,15 @@ test_hdy_preferences_page_add (void)
g_test_expect_message (HDY_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "Can't add children of type GtkSwitch to
HdyPreferencesPage");
gtk_container_add (GTK_CONTAINER (page), widget);
g_test_assert_expected_messages ();
+
+ g_object_unref (page);
}
static void
test_hdy_preferences_page_title (void)
{
- g_autoptr (HdyPreferencesPage) page = NULL;
+ HdyPreferencesPage *page;
page = g_object_ref_sink (HDY_PREFERENCES_PAGE (hdy_preferences_page_new ()));
g_assert_nonnull (page);
@@ -44,13 +46,15 @@ test_hdy_preferences_page_title (void)
hdy_preferences_page_set_title (page, NULL);
g_assert_null (hdy_preferences_page_get_title (page));
+
+ g_object_unref (page);
}
static void
test_hdy_preferences_page_icon_name (void)
{
- g_autoptr (HdyPreferencesPage) page = NULL;
+ HdyPreferencesPage *page;
page = g_object_ref_sink (HDY_PREFERENCES_PAGE (hdy_preferences_page_new ()));
g_assert_nonnull (page);
@@ -62,6 +66,8 @@ test_hdy_preferences_page_icon_name (void)
hdy_preferences_page_set_icon_name (page, NULL);
g_assert_null (hdy_preferences_page_get_icon_name (page));
+
+ g_object_unref (page);
}
diff --git a/tests/test-preferences-row.c b/tests/test-preferences-row.c
index 980fa443..5af8c548 100644
--- a/tests/test-preferences-row.c
+++ b/tests/test-preferences-row.c
@@ -10,7 +10,7 @@
static void
test_hdy_preferences_row_title (void)
{
- g_autoptr (HdyPreferencesRow) row = NULL;
+ HdyPreferencesRow *row;
row = g_object_ref_sink (HDY_PREFERENCES_ROW (hdy_preferences_row_new ()));
g_assert_nonnull (row);
@@ -22,13 +22,15 @@ test_hdy_preferences_row_title (void)
hdy_preferences_row_set_title (row, NULL);
g_assert_null (hdy_preferences_row_get_title (row));
+
+ g_object_unref (row);
}
static void
test_hdy_preferences_row_use_undeline (void)
{
- g_autoptr (HdyPreferencesRow) row = NULL;
+ HdyPreferencesRow *row;
row = g_object_ref_sink (HDY_PREFERENCES_ROW (hdy_preferences_row_new ()));
g_assert_nonnull (row);
@@ -40,6 +42,8 @@ test_hdy_preferences_row_use_undeline (void)
hdy_preferences_row_set_use_underline (row, FALSE);
g_assert_false (hdy_preferences_row_get_use_underline (row));
+
+ g_object_unref (row);
}
diff --git a/tests/test-preferences-window.c b/tests/test-preferences-window.c
index 73313794..2b0e5ee2 100644
--- a/tests/test-preferences-window.c
+++ b/tests/test-preferences-window.c
@@ -10,7 +10,7 @@
static void
test_hdy_preferences_window_add (void)
{
- g_autoptr (HdyPreferencesWindow) window = NULL;
+ HdyPreferencesWindow *window;
HdyPreferencesPage *page;
GtkWidget *widget;
@@ -26,6 +26,8 @@ test_hdy_preferences_window_add (void)
g_test_expect_message (HDY_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "Can't add children of type GtkSwitch to
HdyPreferencesWindow");
gtk_container_add (GTK_CONTAINER (window), widget);
g_test_assert_expected_messages ();
+
+ g_object_unref (window);
}
diff --git a/tests/test-search-bar.c b/tests/test-search-bar.c
index d6350188..14e43c42 100644
--- a/tests/test-search-bar.c
+++ b/tests/test-search-bar.c
@@ -10,7 +10,7 @@
static void
test_hdy_search_bar_add (void)
{
- g_autoptr (HdySearchBar) bar = NULL;
+ HdySearchBar *bar;
GtkWidget *entry;
bar = g_object_ref_sink (HDY_SEARCH_BAR (hdy_search_bar_new ()));
@@ -20,13 +20,15 @@ test_hdy_search_bar_add (void)
g_assert_nonnull (entry);
gtk_container_add (GTK_CONTAINER (bar), entry);
+
+ g_object_unref (bar);
}
static void
test_hdy_search_bar_connect_entry (void)
{
- g_autoptr (HdySearchBar) bar = NULL;
+ HdySearchBar *bar;
GtkWidget *box, *entry;
bar = g_object_ref_sink (HDY_SEARCH_BAR (hdy_search_bar_new ()));
@@ -41,13 +43,15 @@ test_hdy_search_bar_connect_entry (void)
gtk_container_add (GTK_CONTAINER (box), entry);
gtk_container_add (GTK_CONTAINER (bar), box);
hdy_search_bar_connect_entry (bar, GTK_ENTRY (entry));
+
+ g_object_unref (bar);
}
static void
test_hdy_search_bar_search_mode (void)
{
- g_autoptr (HdySearchBar) bar = NULL;
+ HdySearchBar *bar;
bar = g_object_ref_sink (HDY_SEARCH_BAR (hdy_search_bar_new ()));
g_assert_nonnull (bar);
@@ -59,13 +63,15 @@ test_hdy_search_bar_search_mode (void)
hdy_search_bar_set_search_mode (bar, FALSE);
g_assert_false (hdy_search_bar_get_search_mode (bar));
+
+ g_object_unref (bar);
}
static void
test_hdy_search_bar_show_close_button (void)
{
- g_autoptr (HdySearchBar) bar = NULL;
+ HdySearchBar *bar;
bar = g_object_ref_sink (HDY_SEARCH_BAR (hdy_search_bar_new ()));
g_assert_nonnull (bar);
@@ -77,6 +83,8 @@ test_hdy_search_bar_show_close_button (void)
hdy_search_bar_set_show_close_button (bar, FALSE);
g_assert_false (hdy_search_bar_get_show_close_button (bar));
+
+ g_object_unref (bar);
}
diff --git a/tests/test-squeezer.c b/tests/test-squeezer.c
index b41df8e4..e0fd1a34 100644
--- a/tests/test-squeezer.c
+++ b/tests/test-squeezer.c
@@ -10,7 +10,7 @@
static void
test_hdy_squeezer_homogeneous (void)
{
- g_autoptr (HdySqueezer) squeezer = NULL;
+ HdySqueezer *squeezer;
squeezer = g_object_ref_sink (HDY_SQUEEZER (hdy_squeezer_new ()));
g_assert_nonnull (squeezer);
@@ -22,13 +22,15 @@ test_hdy_squeezer_homogeneous (void)
hdy_squeezer_set_homogeneous (squeezer, TRUE);
g_assert_true (hdy_squeezer_get_homogeneous (squeezer));
+
+ g_object_unref (squeezer);
}
static void
test_hdy_squeezer_transition_duration (void)
{
- g_autoptr (HdySqueezer) squeezer = NULL;
+ HdySqueezer *squeezer;
squeezer = g_object_ref_sink (HDY_SQUEEZER (hdy_squeezer_new ()));
g_assert_nonnull (squeezer);
@@ -40,13 +42,15 @@ test_hdy_squeezer_transition_duration (void)
hdy_squeezer_set_transition_duration (squeezer, -1);
g_assert_cmpuint (hdy_squeezer_get_transition_duration (squeezer), ==, G_MAXUINT);
+
+ g_object_unref (squeezer);
}
static void
test_hdy_squeezer_transition_type (void)
{
- g_autoptr (HdySqueezer) squeezer = NULL;
+ HdySqueezer *squeezer;
squeezer = g_object_ref_sink (HDY_SQUEEZER (hdy_squeezer_new ()));
g_assert_nonnull (squeezer);
@@ -58,25 +62,29 @@ test_hdy_squeezer_transition_type (void)
hdy_squeezer_set_transition_type (squeezer, HDY_SQUEEZER_TRANSITION_TYPE_NONE);
g_assert_cmpuint (hdy_squeezer_get_transition_type (squeezer), ==, HDY_SQUEEZER_TRANSITION_TYPE_NONE);
+
+ g_object_unref (squeezer);
}
static void
test_hdy_squeezer_transition_running (void)
{
- g_autoptr (HdySqueezer) squeezer = NULL;
+ HdySqueezer *squeezer;
squeezer = g_object_ref_sink (HDY_SQUEEZER (hdy_squeezer_new ()));
g_assert_nonnull (squeezer);
g_assert_false (hdy_squeezer_get_transition_running (squeezer));
+
+ g_object_unref (squeezer);
}
static void
test_hdy_squeezer_show_hide_child (void)
{
- g_autoptr (HdySqueezer) squeezer = NULL;
+ HdySqueezer *squeezer;
GtkWidget *child;
squeezer = g_object_ref_sink (HDY_SQUEEZER (hdy_squeezer_new ()));
@@ -99,13 +107,15 @@ test_hdy_squeezer_show_hide_child (void)
gtk_container_remove (GTK_CONTAINER (squeezer), child);
g_assert_null (hdy_squeezer_get_visible_child (squeezer));
+
+ g_object_unref (squeezer);
}
static void
test_hdy_squeezer_interpolate_size (void)
{
- g_autoptr (HdySqueezer) squeezer = NULL;
+ HdySqueezer *squeezer;
squeezer = g_object_ref_sink (HDY_SQUEEZER (hdy_squeezer_new ()));
g_assert_nonnull (squeezer);
@@ -117,13 +127,15 @@ test_hdy_squeezer_interpolate_size (void)
hdy_squeezer_set_interpolate_size (squeezer, FALSE);
g_assert_false (hdy_squeezer_get_interpolate_size (squeezer));
+
+ g_object_unref (squeezer);
}
static void
test_hdy_squeezer_child_enabled (void)
{
- g_autoptr (HdySqueezer) squeezer = NULL;
+ HdySqueezer *squeezer;
GtkWidget *child;
squeezer = g_object_ref_sink (HDY_SQUEEZER (hdy_squeezer_new ()));
@@ -139,6 +151,8 @@ test_hdy_squeezer_child_enabled (void)
hdy_squeezer_set_child_enabled (squeezer, child, TRUE);
g_assert_true (hdy_squeezer_get_child_enabled (squeezer, child));
+
+ g_object_unref (squeezer);
}
diff --git a/tests/test-status-page.c b/tests/test-status-page.c
index cc2c064a..2122e79e 100644
--- a/tests/test-status-page.c
+++ b/tests/test-status-page.c
@@ -17,7 +17,7 @@ notify_cb (GtkWidget *widget, gpointer data)
static void
test_hdy_status_page_icon_name (void)
{
- g_autoptr (HdyStatusPage) status_page = NULL;
+ HdyStatusPage *status_page;
const gchar *icon_name = NULL;
status_page = HDY_STATUS_PAGE (g_object_ref_sink (hdy_status_page_new ()));
@@ -39,13 +39,15 @@ test_hdy_status_page_icon_name (void)
g_object_set (status_page, "icon-name", "other-icon-symbolic", NULL);
g_assert_cmpstr (hdy_status_page_get_icon_name (status_page), ==, "other-icon-symbolic");
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (status_page);
}
static void
test_hdy_status_page_title (void)
{
- g_autoptr (HdyStatusPage) status_page = NULL;
- g_autofree gchar *title = NULL;
+ HdyStatusPage *status_page;
+ gchar *title;
status_page = HDY_STATUS_PAGE (g_object_ref_sink (hdy_status_page_new ()));
g_assert_nonnull (status_page);
@@ -66,13 +68,16 @@ test_hdy_status_page_title (void)
g_object_set (status_page, "title", "Other Title", NULL);
g_assert_cmpstr (hdy_status_page_get_title (status_page), ==, "Other Title");
g_assert_cmpint (notified, ==, 2);
+
+ g_free (title);
+ g_object_unref (status_page);
}
static void
test_hdy_status_page_description (void)
{
- g_autoptr (HdyStatusPage) status_page = NULL;
- g_autofree gchar *description = NULL;
+ HdyStatusPage *status_page;
+ gchar *description;
status_page = HDY_STATUS_PAGE (g_object_ref_sink (hdy_status_page_new ()));
g_assert_nonnull (status_page);
@@ -93,6 +98,9 @@ test_hdy_status_page_description (void)
g_object_set (status_page, "description", "Other description", NULL);
g_assert_cmpstr (hdy_status_page_get_description (status_page), ==, "Other description");
g_assert_cmpint (notified, ==, 2);
+
+ g_free (description);
+ g_object_unref (status_page);
}
gint
diff --git a/tests/test-swipe-group.c b/tests/test-swipe-group.c
index 4d5a61dc..81d9d456 100644
--- a/tests/test-swipe-group.c
+++ b/tests/test-swipe-group.c
@@ -11,9 +11,9 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
test_hdy_swipe_group_add_remove (void)
{
- g_autoptr (HdySwipeGroup) group = NULL;
- g_autoptr (HdySwipeable) swipeable1 = NULL;
- g_autoptr (HdySwipeable) swipeable2 = NULL;
+ HdySwipeGroup *group;
+ HdySwipeable *swipeable1;
+ HdySwipeable *swipeable2;
group = hdy_swipe_group_new ();
@@ -33,6 +33,10 @@ test_hdy_swipe_group_add_remove (void)
hdy_swipe_group_remove_swipeable (group, swipeable1);
g_assert_cmpint (g_slist_length (hdy_swipe_group_get_swipeables (group)), ==, 0);
+
+ g_object_unref (swipeable2);
+ g_object_unref (swipeable1);
+ g_object_unref (group);
}
G_GNUC_END_IGNORE_DEPRECATIONS
diff --git a/tests/test-tab-bar.c b/tests/test-tab-bar.c
index 576639ba..16c45cbc 100644
--- a/tests/test-tab-bar.c
+++ b/tests/test-tab-bar.c
@@ -19,8 +19,8 @@ notify_cb (GtkWidget *widget, gpointer data)
static void
test_hdy_tab_bar_view (void)
{
- g_autoptr (HdyTabBar) bar = NULL;
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabBar *bar;
+ HdyTabView *view;
bar = g_object_ref_sink (HDY_TAB_BAR (hdy_tab_bar_new ()));
g_assert_nonnull (bar);
@@ -42,12 +42,15 @@ test_hdy_tab_bar_view (void)
g_object_set (bar, "view", NULL, NULL);
g_assert_null (hdy_tab_bar_get_view (bar));
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (view);
+ g_object_unref (bar);
}
static void
test_hdy_tab_bar_start_action_widget (void)
{
- g_autoptr (HdyTabBar) bar = NULL;
+ HdyTabBar *bar;
GtkWidget *widget = NULL;
bar = g_object_ref_sink (HDY_TAB_BAR (hdy_tab_bar_new ()));
@@ -70,12 +73,14 @@ test_hdy_tab_bar_start_action_widget (void)
g_object_set (bar, "start-action-widget", NULL, NULL);
g_assert_null (hdy_tab_bar_get_start_action_widget (bar));
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (bar);
}
static void
test_hdy_tab_bar_end_action_widget (void)
{
- g_autoptr (HdyTabBar) bar = NULL;
+ HdyTabBar *bar;
GtkWidget *widget = NULL;
bar = g_object_ref_sink (HDY_TAB_BAR (hdy_tab_bar_new ()));
@@ -98,12 +103,14 @@ test_hdy_tab_bar_end_action_widget (void)
g_object_set (bar, "end-action-widget", NULL, NULL);
g_assert_null (hdy_tab_bar_get_end_action_widget (bar));
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (bar);
}
static void
test_hdy_tab_bar_autohide (void)
{
- g_autoptr (HdyTabBar) bar = NULL;
+ HdyTabBar *bar;
gboolean autohide = FALSE;
bar = g_object_ref_sink (HDY_TAB_BAR (hdy_tab_bar_new ()));
@@ -125,13 +132,15 @@ test_hdy_tab_bar_autohide (void)
g_object_set (bar, "autohide", TRUE, NULL);
g_assert_true (hdy_tab_bar_get_autohide (bar));
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (bar);
}
static void
test_hdy_tab_bar_tabs_revealed (void)
{
- g_autoptr (HdyTabBar) bar = NULL;
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabBar *bar;
+ HdyTabView *view;
gboolean tabs_revealed = FALSE;
HdyTabPage *page;
@@ -178,12 +187,15 @@ test_hdy_tab_bar_tabs_revealed (void)
hdy_tab_bar_set_autohide (bar, FALSE);
g_assert_true (hdy_tab_bar_get_tabs_revealed (bar));
g_assert_cmpint (notified, ==, 7);
+
+ g_object_unref (view);
+ g_object_unref (bar);
}
static void
test_hdy_tab_bar_expand_tabs (void)
{
- g_autoptr (HdyTabBar) bar = NULL;
+ HdyTabBar *bar;
gboolean expand_tabs = FALSE;
bar = g_object_ref_sink (HDY_TAB_BAR (hdy_tab_bar_new ()));
@@ -205,12 +217,14 @@ test_hdy_tab_bar_expand_tabs (void)
g_object_set (bar, "expand-tabs", TRUE, NULL);
g_assert_true (hdy_tab_bar_get_expand_tabs (bar));
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (bar);
}
static void
test_hdy_tab_bar_inverted (void)
{
- g_autoptr (HdyTabBar) bar = NULL;
+ HdyTabBar *bar;
gboolean inverted = FALSE;
bar = g_object_ref_sink (HDY_TAB_BAR (hdy_tab_bar_new ()));
@@ -232,6 +246,8 @@ test_hdy_tab_bar_inverted (void)
g_object_set (bar, "inverted", FALSE, NULL);
g_assert_false (hdy_tab_bar_get_inverted (bar));
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (bar);
}
gint
diff --git a/tests/test-tab-view.c b/tests/test-tab-view.c
index 27d2179f..44d8f01b 100644
--- a/tests/test-tab-view.c
+++ b/tests/test-tab-view.c
@@ -59,7 +59,7 @@ assert_page_positions (HdyTabView *view,
static void
test_hdy_tab_view_n_pages (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
HdyTabPage *page;
gint n_pages;
@@ -93,12 +93,14 @@ test_hdy_tab_view_n_pages (void)
hdy_tab_view_close_page (view, page);
g_assert_cmpint (hdy_tab_view_get_n_pages (view), ==, 2);
g_assert_cmpint (notified, ==, 4);
+
+ g_object_unref (view);
}
static void
test_hdy_tab_view_n_pinned_pages (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
HdyTabPage *page;
gint n_pages;
@@ -132,16 +134,18 @@ test_hdy_tab_view_n_pinned_pages (void)
hdy_tab_view_set_page_pinned (view, page, FALSE);
g_assert_cmpint (hdy_tab_view_get_n_pinned_pages (view), ==, 1);
g_assert_cmpint (notified, ==, 3);
+
+ g_object_unref (view);
}
static void
test_hdy_tab_view_default_icon (void)
{
- g_autoptr (HdyTabView) view = NULL;
- g_autoptr (GIcon) icon = NULL;
- g_autoptr (GIcon) icon1 = g_themed_icon_new ("go-previous-symbolic");
- g_autoptr (GIcon) icon2 = g_themed_icon_new ("go-next-symbolic");
- g_autofree gchar *icon_str = NULL;
+ HdyTabView *view;
+ GIcon *icon;
+ GIcon *icon1 = g_themed_icon_new ("go-previous-symbolic");
+ GIcon *icon2 = g_themed_icon_new ("go-next-symbolic");
+ gchar *icon_str;
view = g_object_ref_sink (HDY_TAB_VIEW (hdy_tab_view_new ()));
g_assert_nonnull (view);
@@ -161,15 +165,21 @@ test_hdy_tab_view_default_icon (void)
g_object_set (view, "default-icon", icon2, NULL);
g_assert_true (hdy_tab_view_get_default_icon (view) == icon2);
g_assert_cmpint (notified, ==, 2);
+
+ g_free (icon_str);
+ g_object_unref (icon);
+ g_object_unref (icon2);
+ g_object_unref (icon1);
+ g_object_unref (view);
}
static void
test_hdy_tab_view_menu_model (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
GMenuModel *model = NULL;
- g_autoptr (GMenuModel) model1 = G_MENU_MODEL (g_menu_new ());
- g_autoptr (GMenuModel) model2 = G_MENU_MODEL (g_menu_new ());
+ GMenuModel *model1 = G_MENU_MODEL (g_menu_new ());
+ GMenuModel *model2 = G_MENU_MODEL (g_menu_new ());
view = g_object_ref_sink (HDY_TAB_VIEW (hdy_tab_view_new ()));
g_assert_nonnull (view);
@@ -188,15 +198,19 @@ test_hdy_tab_view_menu_model (void)
g_object_set (view, "menu-model", model2, NULL);
g_assert_true (hdy_tab_view_get_menu_model (view) == model2);
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (view);
+ g_object_unref (model2);
+ g_object_unref (model1);
}
static void
test_hdy_tab_view_shortcut_widget (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
GtkWidget *widget = NULL;
- g_autoptr (GtkWidget) widget1 = g_object_ref_sink (gtk_button_new ());
- g_autoptr (GtkWidget) widget2 = g_object_ref_sink (gtk_button_new ());
+ GtkWidget *widget1 = g_object_ref_sink (gtk_button_new ());
+ GtkWidget *widget2 = g_object_ref_sink (gtk_button_new ());
view = g_object_ref_sink (HDY_TAB_VIEW (hdy_tab_view_new ()));
g_assert_nonnull (view);
@@ -215,12 +229,16 @@ test_hdy_tab_view_shortcut_widget (void)
g_object_set (view, "shortcut-widget", widget2, NULL);
g_assert_true (hdy_tab_view_get_shortcut_widget (view) == widget2);
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (view);
+ g_object_unref (widget2);
+ g_object_unref (widget1);
}
static void
test_hdy_tab_view_pages (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
GtkWidget *child1, *child2, *child3;
HdyTabPage *page1, *page2, *page3;
@@ -250,12 +268,14 @@ test_hdy_tab_view_pages (void)
g_assert_true (hdy_tab_page_get_child (page1) == child1);
g_assert_true (hdy_tab_page_get_child (page2) == child2);
g_assert_true (hdy_tab_page_get_child (page3) == child3);
+
+ g_object_unref (view);
}
static void
test_hdy_tab_view_select (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
HdyTabPage *page1, *page2, *selected_page;
gboolean ret;
@@ -306,12 +326,14 @@ test_hdy_tab_view_select (void)
g_assert_true (hdy_tab_view_get_selected_page (view) == page1);
g_assert_true (ret);
g_assert_cmpint (notified, ==, 5);
+
+ g_object_unref (view);
}
static void
test_hdy_tab_view_add_basic (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
HdyTabPage *pages[6];
view = g_object_ref_sink (HDY_TAB_VIEW (hdy_tab_view_new ()));
@@ -340,12 +362,14 @@ test_hdy_tab_view_add_basic (void)
pages[5] = hdy_tab_view_insert_pinned (view, gtk_button_new (), 1);
assert_page_positions (view, pages, 6, 3,
3, 5, 4, 1, 2, 0);
+
+ g_object_unref (view);
}
static void
test_hdy_tab_view_add_auto (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
HdyTabPage *pages[17];
view = g_object_ref_sink (HDY_TAB_VIEW (hdy_tab_view_new ()));
@@ -432,12 +456,14 @@ test_hdy_tab_view_add_auto (void)
g_assert_true (hdy_tab_page_get_parent (pages[16]) == pages[5]);
assert_page_positions (view, pages, 17, 3,
0, 1, 2, 15, 14, 11, 12, 13, 3, 4, 6, 8, 9, 7, 10, 5, 16);
+
+ g_object_unref (view);
}
static void
test_hdy_tab_view_reorder (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
HdyTabPage *pages[6];
gboolean ret;
@@ -478,12 +504,14 @@ test_hdy_tab_view_reorder (void)
g_assert_true (ret);
assert_page_positions (view, pages, 6, 3,
0, 1, 2, 3, 4, 5);
+
+ g_object_unref (view);
}
static void
test_hdy_tab_view_reorder_first_last (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
HdyTabPage *pages[6];
gboolean ret;
@@ -534,12 +562,14 @@ test_hdy_tab_view_reorder_first_last (void)
g_assert_true (ret);
assert_page_positions (view, pages, 6, 3,
0, 1, 2, 3, 4, 5);
+
+ g_object_unref (view);
}
static void
test_hdy_tab_view_reorder_forward_backward (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
HdyTabPage *pages[6];
gboolean ret;
@@ -590,12 +620,14 @@ test_hdy_tab_view_reorder_forward_backward (void)
g_assert_true (ret);
assert_page_positions (view, pages, 6, 3,
1, 2, 0, 4, 5, 3);
+
+ g_object_unref (view);
}
static void
test_hdy_tab_view_pin (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
HdyTabPage *pages[4];
view = g_object_ref_sink (HDY_TAB_VIEW (hdy_tab_view_new ()));
@@ -638,12 +670,14 @@ test_hdy_tab_view_pin (void)
hdy_tab_view_set_page_pinned (view, pages[1], FALSE);
assert_page_positions (view, pages, 4, 2,
2, 0, 1, 3);
+
+ g_object_unref (view);
}
static void
test_hdy_tab_view_close (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
HdyTabPage *pages[3];
view = g_object_ref_sink (HDY_TAB_VIEW (hdy_tab_view_new ()));
@@ -669,12 +703,14 @@ test_hdy_tab_view_close (void)
hdy_tab_view_close_page (view, pages[0]);
assert_page_positions (view, pages, 0, 0);
g_assert_null (hdy_tab_view_get_selected_page (view));
+
+ g_object_unref (view);
}
static void
test_hdy_tab_view_close_other (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
HdyTabPage *pages[6];
view = g_object_ref_sink (HDY_TAB_VIEW (hdy_tab_view_new ()));
@@ -691,12 +727,14 @@ test_hdy_tab_view_close_other (void)
hdy_tab_view_close_other_pages (view, pages[2]);
assert_page_positions (view, pages, 3, 3,
0, 1, 2);
+
+ g_object_unref (view);
}
static void
test_hdy_tab_view_close_before_after (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
HdyTabPage *pages[10];
view = g_object_ref_sink (HDY_TAB_VIEW (hdy_tab_view_new ()));
@@ -721,6 +759,8 @@ test_hdy_tab_view_close_before_after (void)
hdy_tab_view_close_pages_after (view, pages[0]);
assert_page_positions (view, pages, 3, 3,
0, 1, 2);
+
+ g_object_unref (view);
}
static gboolean
@@ -737,7 +777,7 @@ close_page_position_cb (HdyTabView *view,
static void
test_hdy_tab_view_close_signal (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
HdyTabPage *pages[10];
gulong handler;
@@ -778,12 +818,14 @@ test_hdy_tab_view_close_signal (void)
2, 4, 5, 6, 8);
g_signal_handler_disconnect (view, handler);
+
+ g_object_unref (view);
}
static void
test_hdy_tab_view_close_select (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
HdyTabPage *pages[14];
view = g_object_ref_sink (HDY_TAB_VIEW (hdy_tab_view_new ()));
@@ -850,13 +892,15 @@ test_hdy_tab_view_close_select (void)
hdy_tab_view_close_page (view, pages[12]);
g_assert_true (hdy_tab_view_get_selected_page (view) == pages[1]);
+
+ g_object_unref (view);
}
static void
test_hdy_tab_view_transfer (void)
{
- g_autoptr (HdyTabView) view1 = NULL;
- g_autoptr (HdyTabView) view2 = NULL;
+ HdyTabView *view1;
+ HdyTabView *view2;
HdyTabPage *pages1[4], *pages2[4];
view1 = g_object_ref_sink (HDY_TAB_VIEW (hdy_tab_view_new ()));
@@ -886,12 +930,15 @@ test_hdy_tab_view_transfer (void)
assert_page_positions (view2, pages2, 4, 3,
0, -1, 1, 2);
g_assert_true (hdy_tab_view_get_nth_page (view1, 2) == pages2[3]);
+
+ g_object_unref (view2);
+ g_object_unref (view1);
}
static void
test_hdy_tab_page_title (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
HdyTabPage *page;
const gchar *title;
@@ -915,12 +962,14 @@ test_hdy_tab_page_title (void)
g_object_set (page, "title", "Some other title", NULL);
g_assert_cmpstr (hdy_tab_page_get_title (page), ==, "Some other title");
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (view);
}
static void
test_hdy_tab_page_tooltip (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
HdyTabPage *page;
const gchar *tooltip;
@@ -944,16 +993,18 @@ test_hdy_tab_page_tooltip (void)
g_object_set (page, "tooltip", "Some other tooltip", NULL);
g_assert_cmpstr (hdy_tab_page_get_tooltip (page), ==, "Some other tooltip");
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (view);
}
static void
test_hdy_tab_page_icon (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
HdyTabPage *page;
GIcon *icon = NULL;
- g_autoptr (GIcon) icon1 = g_themed_icon_new ("go-previous-symbolic");
- g_autoptr (GIcon) icon2 = g_themed_icon_new ("go-next-symbolic");
+ GIcon *icon1 = g_themed_icon_new ("go-previous-symbolic");
+ GIcon *icon2 = g_themed_icon_new ("go-next-symbolic");
view = g_object_ref_sink (HDY_TAB_VIEW (hdy_tab_view_new ()));
g_assert_nonnull (view);
@@ -975,12 +1026,16 @@ test_hdy_tab_page_icon (void)
g_object_set (page, "icon", icon2, NULL);
g_assert_true (hdy_tab_page_get_icon (page) == icon2);
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (view);
+ g_object_unref (icon2);
+ g_object_unref (icon1);
}
static void
test_hdy_tab_page_loading (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
HdyTabPage *page;
gboolean loading;
@@ -1005,16 +1060,18 @@ test_hdy_tab_page_loading (void)
g_object_set (page, "loading", FALSE, NULL);
g_assert_false (hdy_tab_page_get_loading (page));
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (view);
}
static void
test_hdy_tab_page_indicator_icon (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
HdyTabPage *page;
GIcon *icon = NULL;
- g_autoptr (GIcon) icon1 = g_themed_icon_new ("go-previous-symbolic");
- g_autoptr (GIcon) icon2 = g_themed_icon_new ("go-next-symbolic");
+ GIcon *icon1 = g_themed_icon_new ("go-previous-symbolic");
+ GIcon *icon2 = g_themed_icon_new ("go-next-symbolic");
view = g_object_ref_sink (HDY_TAB_VIEW (hdy_tab_view_new ()));
g_assert_nonnull (view);
@@ -1036,12 +1093,16 @@ test_hdy_tab_page_indicator_icon (void)
g_object_set (page, "indicator-icon", icon2, NULL);
g_assert_true (hdy_tab_page_get_indicator_icon (page) == icon2);
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (view);
+ g_object_unref (icon2);
+ g_object_unref (icon1);
}
static void
test_hdy_tab_page_indicator_activatable (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
HdyTabPage *page;
gboolean activatable;
@@ -1066,12 +1127,14 @@ test_hdy_tab_page_indicator_activatable (void)
g_object_set (page, "indicator-activatable", FALSE, NULL);
g_assert_false (hdy_tab_page_get_indicator_activatable (page));
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (view);
}
static void
test_hdy_tab_page_needs_attention (void)
{
- g_autoptr (HdyTabView) view = NULL;
+ HdyTabView *view;
HdyTabPage *page;
gboolean needs_attention;
@@ -1096,6 +1159,8 @@ test_hdy_tab_page_needs_attention (void)
g_object_set (page, "needs-attention", FALSE, NULL);
g_assert_false (hdy_tab_page_get_needs_attention (page));
g_assert_cmpint (notified, ==, 2);
+
+ g_object_unref (view);
}
gint
diff --git a/tests/test-view-switcher-bar.c b/tests/test-view-switcher-bar.c
index 2634818a..9eecb07f 100644
--- a/tests/test-view-switcher-bar.c
+++ b/tests/test-view-switcher-bar.c
@@ -10,7 +10,7 @@
static void
test_hdy_view_switcher_bar_policy (void)
{
- g_autoptr (HdyViewSwitcherBar) bar = NULL;
+ HdyViewSwitcherBar *bar;
bar = g_object_ref_sink (HDY_VIEW_SWITCHER_BAR (hdy_view_switcher_bar_new ()));
g_assert_nonnull (bar);
@@ -25,13 +25,15 @@ test_hdy_view_switcher_bar_policy (void)
hdy_view_switcher_bar_set_policy (bar, HDY_VIEW_SWITCHER_POLICY_NARROW);
g_assert_cmpint (hdy_view_switcher_bar_get_policy (bar), ==, HDY_VIEW_SWITCHER_POLICY_NARROW);
+
+ g_object_unref (bar);
}
static void
test_hdy_view_switcher_bar_stack (void)
{
- g_autoptr (HdyViewSwitcherBar) bar = NULL;
+ HdyViewSwitcherBar *bar;
GtkStack *stack;
bar = g_object_ref_sink (HDY_VIEW_SWITCHER_BAR (hdy_view_switcher_bar_new ()));
@@ -47,13 +49,15 @@ test_hdy_view_switcher_bar_stack (void)
hdy_view_switcher_bar_set_stack (bar, NULL);
g_assert_null (hdy_view_switcher_bar_get_stack (bar));
+
+ g_object_unref (bar);
}
static void
test_hdy_view_switcher_bar_reveal (void)
{
- g_autoptr (HdyViewSwitcherBar) bar = NULL;
+ HdyViewSwitcherBar *bar;
bar = g_object_ref_sink (HDY_VIEW_SWITCHER_BAR (hdy_view_switcher_bar_new ()));
g_assert_nonnull (bar);
@@ -65,6 +69,8 @@ test_hdy_view_switcher_bar_reveal (void)
hdy_view_switcher_bar_set_reveal (bar, FALSE);
g_assert_false (hdy_view_switcher_bar_get_reveal (bar));
+
+ g_object_unref (bar);
}
diff --git a/tests/test-view-switcher.c b/tests/test-view-switcher.c
index 1672f182..9088b4b5 100644
--- a/tests/test-view-switcher.c
+++ b/tests/test-view-switcher.c
@@ -10,7 +10,7 @@
static void
test_hdy_view_switcher_policy (void)
{
- g_autoptr (HdyViewSwitcher) view_switcher = NULL;
+ HdyViewSwitcher *view_switcher;
view_switcher = g_object_ref_sink (HDY_VIEW_SWITCHER (hdy_view_switcher_new ()));
g_assert_nonnull (view_switcher);
@@ -25,13 +25,15 @@ test_hdy_view_switcher_policy (void)
hdy_view_switcher_set_policy (view_switcher, HDY_VIEW_SWITCHER_POLICY_AUTO);
g_assert_cmpint (hdy_view_switcher_get_policy (view_switcher), ==, HDY_VIEW_SWITCHER_POLICY_AUTO);
+
+ g_object_unref (view_switcher);
}
static void
test_hdy_view_switcher_narrow_ellipsize (void)
{
- g_autoptr (HdyViewSwitcher) view_switcher = NULL;
+ HdyViewSwitcher *view_switcher;
view_switcher = g_object_ref_sink (HDY_VIEW_SWITCHER (hdy_view_switcher_new ()));
g_assert_nonnull (view_switcher);
@@ -43,13 +45,15 @@ test_hdy_view_switcher_narrow_ellipsize (void)
hdy_view_switcher_set_narrow_ellipsize (view_switcher, PANGO_ELLIPSIZE_NONE);
g_assert_cmpint (hdy_view_switcher_get_narrow_ellipsize (view_switcher), ==, PANGO_ELLIPSIZE_NONE);
+
+ g_object_unref (view_switcher);
}
static void
test_hdy_view_switcher_stack (void)
{
- g_autoptr (HdyViewSwitcher) view_switcher = NULL;
+ HdyViewSwitcher *view_switcher;
GtkStack *stack;
view_switcher = g_object_ref_sink (HDY_VIEW_SWITCHER (hdy_view_switcher_new ()));
@@ -65,6 +69,8 @@ test_hdy_view_switcher_stack (void)
hdy_view_switcher_set_stack (view_switcher, NULL);
g_assert_null (hdy_view_switcher_get_stack (view_switcher));
+
+ g_object_unref (view_switcher);
}
diff --git a/tests/test-window-handle.c b/tests/test-window-handle.c
index c97dce8e..f5a95398 100644
--- a/tests/test-window-handle.c
+++ b/tests/test-window-handle.c
@@ -10,10 +10,12 @@
static void
test_hdy_window_handle_new (void)
{
- g_autoptr (GtkWidget) handle = NULL;
+ GtkWidget *handle;
handle = g_object_ref_sink (hdy_window_handle_new ());
g_assert_nonnull (handle);
+
+ g_object_unref (handle);
}
diff --git a/tests/test-window.c b/tests/test-window.c
index ff6382ec..f20fd3b5 100644
--- a/tests/test-window.c
+++ b/tests/test-window.c
@@ -10,10 +10,12 @@
static void
test_hdy_window_new (void)
{
- g_autoptr (GtkWidget) window = NULL;
+ GtkWidget *window;
window = g_object_ref_sink (hdy_window_new ());
g_assert_nonnull (window);
+
+ g_object_unref (window);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]