~indicator-applet-developers/indicator-sound/trunk.14.04

« back to all changes in this revision

Viewing changes to tests/greeter-list.cc

  • Committer: CI bot
  • Author(s): Ted Gould
  • Date: 2014-04-01 23:20:15 UTC
  • mfrom: (435.2.4 null-selected-user)
  • Revision ID: ps-jenkins@lists.canonical.com-20140401232015-5y51og90dn4kox8u
Check the username has been gotten before using it. Fixes: 1297078

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2014 Canonical Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; version 3.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authors:
 
17
 *      Ted Gould <ted@canonical.com>
 
18
 */
 
19
 
 
20
#include <gtest/gtest.h>
 
21
#include <gio/gio.h>
 
22
 
 
23
extern "C" {
 
24
#include "indicator-sound-service.h"
 
25
#include "vala-mocks.h"
 
26
}
 
27
 
 
28
class GreeterListTest : public ::testing::Test
 
29
{
 
30
        protected:
 
31
                GTestDBus * bus = nullptr;
 
32
 
 
33
                virtual void SetUp() {
 
34
                        bus = g_test_dbus_new(G_TEST_DBUS_NONE);
 
35
                        g_test_dbus_up(bus);
 
36
                }
 
37
 
 
38
                virtual void TearDown() {
 
39
                        g_test_dbus_down(bus);
 
40
                        g_clear_object(&bus);
 
41
                }
 
42
 
 
43
};
 
44
 
 
45
TEST_F(GreeterListTest, BasicObject) {
 
46
        MediaPlayerListGreeter * list = media_player_list_greeter_new();
 
47
 
 
48
        ASSERT_NE(nullptr, list);
 
49
 
 
50
        g_clear_object(&list);
 
51
        return;
 
52
}
 
53
 
 
54
TEST_F(GreeterListTest, BasicIterator) {
 
55
        MediaPlayerListGreeter * list = media_player_list_greeter_new();
 
56
        ASSERT_NE(nullptr, list);
 
57
 
 
58
        MediaPlayerListGreeterIterator * iter = media_player_list_greeter_iterator_new(list);
 
59
        ASSERT_NE(nullptr, iter);
 
60
 
 
61
        MediaPlayer * player = media_player_list_iterator_next_value (MEDIA_PLAYER_LIST_ITERATOR(iter));
 
62
        ASSERT_EQ(nullptr, player);
 
63
 
 
64
        g_clear_object(&iter);
 
65
        g_clear_object(&list);
 
66
        return;
 
67
}
 
68