aboutsummaryrefslogtreecommitdiff
path: root/tests/gtest-gvariant.h
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2015-02-12 16:33:32 -0600
committerTed Gould <ted@gould.cx>2015-02-12 16:33:32 -0600
commit202d0be7d82b6c35ba444d433e6d64784d460699 (patch)
treecfc0988c4bcfd5dc2563514171f65c99feda247f /tests/gtest-gvariant.h
parent415bca4595a4d24253b543b598c501abe5ba8949 (diff)
downloadayatana-indicator-sound-202d0be7d82b6c35ba444d433e6d64784d460699.tar.gz
ayatana-indicator-sound-202d0be7d82b6c35ba444d433e6d64784d460699.tar.bz2
ayatana-indicator-sound-202d0be7d82b6c35ba444d433e6d64784d460699.zip
Have a version for those who want parse and have a GVariant pointer
Diffstat (limited to 'tests/gtest-gvariant.h')
-rw-r--r--tests/gtest-gvariant.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/gtest-gvariant.h b/tests/gtest-gvariant.h
index 6f93906..38fde0f 100644
--- a/tests/gtest-gvariant.h
+++ b/tests/gtest-gvariant.h
@@ -89,6 +89,21 @@ testing::AssertionResult expectVariantEqual (const gchar * expectStr, const gcha
return expectVariantEqual(expectStr, haveStr, expectv, have);
}
+testing::AssertionResult expectVariantEqual (const gchar * expectStr, const gchar * haveStr, const char * expect, GVariant * have)
+{
+ auto havep = std::shared_ptr<GVariant>([have] {
+ if (have != nullptr)
+ g_variant_ref_sink(have);
+ return have;
+ }(),
+ [](GVariant * variant) {
+ if (variant != nullptr)
+ g_variant_unref(variant);
+ });
+
+ return expectVariantEqual(expectStr, haveStr, expect, havep);
+}
+
}; // ns GTestGVariant
#define EXPECT_GVARIANT_EQ(expect, have) \