diff options
author | Ted Gould <ted@gould.cx> | 2015-02-09 12:03:29 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2015-02-09 12:03:29 -0600 |
commit | fe57009ba87b4cd9403cd219c26cc9487ac5d276 (patch) | |
tree | 650badba798d4c1c5c109c309496a334edb79f47 /tests | |
parent | 52dafd6b57679d35d7bdedda447da37ebdf4493a (diff) | |
download | ayatana-indicator-sound-fe57009ba87b4cd9403cd219c26cc9487ac5d276.tar.gz ayatana-indicator-sound-fe57009ba87b4cd9403cd219c26cc9487ac5d276.tar.bz2 ayatana-indicator-sound-fe57009ba87b4cd9403cd219c26cc9487ac5d276.zip |
Bringing the eventually to all the test types
Diffstat (limited to 'tests')
-rw-r--r-- | tests/indicator-fixture.h | 46 |
1 files changed, 39 insertions, 7 deletions
diff --git a/tests/indicator-fixture.h b/tests/indicator-fixture.h index c269be5..e725a50 100644 --- a/tests/indicator-fixture.h +++ b/tests/indicator-fixture.h @@ -272,6 +272,13 @@ class IndicatorFixture : public ::testing::Test return result; } + template <typename... Args> testing::AssertionResult expectEventuallyActionStateExists (Args&& ... args) { + std::function<testing::AssertionResult(void)> func = [&]() { + return expectActionStateExists(std::forward<Args>(args)...); + }; + return expectEventually(func); + } + testing::AssertionResult expectActionStateType (const char * nameStr, const char * typeStr, const std::string& name, const GVariantType * type) { auto atype = g_action_group_get_action_state_type(run->_actions.get(), name.c_str()); bool same = false; @@ -294,6 +301,13 @@ class IndicatorFixture : public ::testing::Test return result; } + template <typename... Args> testing::AssertionResult expectEventuallyActionStateType (Args&& ... args) { + std::function<testing::AssertionResult(void)> func = [&]() { + return expectActionStateType(std::forward<Args>(args)...); + }; + return expectEventually(func); + } + testing::AssertionResult expectActionStateIs (const char * nameStr, const char * valueStr, const std::string& name, GVariant * value) { auto varref = std::shared_ptr<GVariant>(g_variant_ref_sink(value), [](GVariant * varptr) { if (varptr != nullptr) @@ -358,6 +372,13 @@ class IndicatorFixture : public ::testing::Test return expectActionStateIs(nameStr, valueStr, name, var); } + template <typename... Args> testing::AssertionResult expectEventuallyActionStateIs (Args&& ... args) { + std::function<testing::AssertionResult(void)> func = [&]() { + return expectActionStateIs(std::forward<Args>(args)...); + }; + return expectEventually(func); + } + private: std::shared_ptr<GVariant> getMenuAttributeVal (int location, std::shared_ptr<GMenuModel>& menu, const std::string& attribute, std::shared_ptr<GVariant>& value) { @@ -462,6 +483,9 @@ class IndicatorFixture : public ::testing::Test } }; +/* Menu Attrib */ +#define ASSERT_MENU_ATTRIB(menu, attrib, value) \ + ASSERT_PRED_FORMAT3(IndicatorFixture::expectMenuAttribute, menu, attrib, value) #define EXPECT_MENU_ATTRIB(menu, attrib, value) \ EXPECT_PRED_FORMAT3(IndicatorFixture::expectMenuAttribute, menu, attrib, value) @@ -469,24 +493,32 @@ class IndicatorFixture : public ::testing::Test #define EXPECT_EVENTUALLY_MENU_ATTRIB(menu, attrib, value) \ EXPECT_PRED_FORMAT3(IndicatorFixture::expectEventuallyMenuAttribute, menu, attrib, value) -#define ASSERT_MENU_ATTRIB(menu, attrib, value) \ - ASSERT_PRED_FORMAT3(IndicatorFixture::expectMenuAttribute, menu, attrib, value) - +/* Action Exists */ #define ASSERT_ACTION_EXISTS(action) \ ASSERT_PRED_FORMAT1(IndicatorFixture::expectActionExists, action) #define EXPECT_ACTION_EXISTS(action) \ EXPECT_PRED_FORMAT1(IndicatorFixture::expectActionExists, action) -#define EXPECT_ACTION_STATE(action, value) \ - EXPECT_PRED_FORMAT2(IndicatorFixture::expectActionStateIs, action, value) +#define EXPECT_EVENTUALLY_ACTION_EXISTS(action) \ + EXPECT_PRED_FORMAT1(IndicatorFixture::expectEventuallyActionExists, action) +/* Action State */ #define ASSERT_ACTION_STATE(action, value) \ ASSERT_PRED_FORMAT2(IndicatorFixture::expectActionStateIs, action, value) -#define EXPECT_ACTION_STATE_TYPE(action, type) \ - EXPECT_PRED_FORMAT2(IndicatorFixture::expectActionStateType, action, type) +#define EXPECT_ACTION_STATE(action, value) \ + EXPECT_PRED_FORMAT2(IndicatorFixture::expectActionStateIs, action, value) + +#define EXPECT_EVENTUALLY_ACTION_STATE(action, value) \ + EXPECT_PRED_FORMAT2(IndicatorFixture::expectEventuallyActionStateIs, action, value) +/* Action State Type */ #define ASSERT_ACTION_STATE_TYPE(action, type) \ ASSERT_PRED_FORMAT2(IndicatorFixture::expectActionStateType, action, type) +#define EXPECT_ACTION_STATE_TYPE(action, type) \ + EXPECT_PRED_FORMAT2(IndicatorFixture::expectActionStateType, action, type) + +#define EXPECT_EVENTUALLY_ACTION_STATE_TYPE(action, type) \ + EXPECT_PRED_FORMAT2(IndicatorFixture::expectEventuallyActionStateType, action, type) |