diff options
author | Ted Gould <ted@gould.cx> | 2015-02-12 16:33:32 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2015-02-12 16:33:32 -0600 |
commit | 202d0be7d82b6c35ba444d433e6d64784d460699 (patch) | |
tree | cfc0988c4bcfd5dc2563514171f65c99feda247f | |
parent | 415bca4595a4d24253b543b598c501abe5ba8949 (diff) | |
download | ayatana-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
-rw-r--r-- | tests/gtest-gvariant.h | 15 |
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) \ |