aboutsummaryrefslogtreecommitdiff
path: root/tests/test-qobject-output-visitor.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2017-02-17 21:38:23 +0100
committerMarkus Armbruster <armbru@redhat.com>2017-02-22 19:52:14 +0100
commitdfad9ec4e9f15344f300996ad8c6f3eaf699d195 (patch)
tree3c338dae06a4aab3f8fbc55dea74b5df6bc01cf2 /tests/test-qobject-output-visitor.c
parent8978b34af3250354e0b67340a7e920f909beda13 (diff)
tests: Don't check qobject_type() before qobject_to_qbool()
qobject_to_qbool(obj) returns NULL when obj isn't a QBool. Check that instead of qobject_type(obj) == QTYPE_QBOOL. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1487363905-9480-13-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests/test-qobject-output-visitor.c')
-rw-r--r--tests/test-qobject-output-visitor.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/test-qobject-output-visitor.c b/tests/test-qobject-output-visitor.c
index 5617fd3404..500b452d98 100644
--- a/tests/test-qobject-output-visitor.c
+++ b/tests/test-qobject-output-visitor.c
@@ -71,13 +71,13 @@ static void test_visitor_out_bool(TestOutputVisitorData *data,
const void *unused)
{
bool value = true;
- QObject *obj;
+ QBool *qbool;
visit_type_bool(data->ov, NULL, &value, &error_abort);
- obj = visitor_get(data);
- g_assert(qobject_type(obj) == QTYPE_QBOOL);
- g_assert(qbool_get_bool(qobject_to_qbool(obj)) == value);
+ qbool = qobject_to_qbool(visitor_get(data));
+ g_assert(qbool);
+ g_assert(qbool_get_bool(qbool) == value);
}
static void test_visitor_out_number(TestOutputVisitorData *data,
@@ -356,9 +356,7 @@ static void test_visitor_out_any(TestOutputVisitorData *data,
qint = qobject_to_qint(qdict_get(qdict, "integer"));
g_assert(qint);
g_assert_cmpint(qint_get_int(qint), ==, -42);
- qobj = qdict_get(qdict, "boolean");
- g_assert(qobj);
- qbool = qobject_to_qbool(qobj);
+ qbool = qobject_to_qbool(qdict_get(qdict, "boolean"));
g_assert(qbool);
g_assert(qbool_get_bool(qbool) == true);
qstring = qobject_to_qstring(qdict_get(qdict, "string"));