summaryrefslogtreecommitdiff
path: root/enhanced-position-service/src/test/ConfigurationTest.cpp
blob: 32861d930a21d90a63bf8242532263aba42ca812 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/**************************************************************************
* @licence app begin@
*
* SPDX-License-Identifier: MPL-2.0
*
* \ingroup EnhancedPositionService
*
* \copyright Copyright (C) BMW Car IT GmbH 2011, 2012
* 
* \license
* This Source Code Form is subject to the terms of the
* Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
* this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* @licence end@
**************************************************************************/

#include <gtest/gtest.h>
#include <stdio.h>

#include "ConfigurationClient.h"
#include "genivi-version.h"

#include "genivi-navigationcore-enum.h"

class ConfigurationTest : public testing::Test {
protected:  // You should make the members protected s.t. they can be
    // accessed from sub-classes.

    ConfigurationTest() : confClient(NULL) {
        QCoreApplication a();
        registerCommTypes();
        confClient = new ConfigurationClient();
    }

    // virtual void SetUp() { }
    // virtual void TearDown() { }

    ConfigurationClient* confClient;
};


TEST_F(ConfigurationTest, getVersionShouldPass) {

    ConfigurationIf* pClient = confClient->getClient();
    ASSERT_FALSE(pClient == NULL);
    ASSERT_TRUE(pClient->isValid());

    // request api version
    QDBusReply<GeniviVersion> replyResult;
    replyResult = pClient->GetVersion();

    ASSERT_TRUE(replyResult.isValid());

    GeniviVersion version = replyResult.value();
    qDebug("API version: %d.%d.%d", version.getMajorVersion(),
               version.getMinorVersion(), version.getMicroVersion());
               // versionDate.toUtf8().data());

    EXPECT_EQ(version.getMajorVersion(), 1);
    EXPECT_EQ(version.getMinorVersion(), 0);
    EXPECT_EQ(version.getMicroVersion(), 0);
}

TEST_F(ConfigurationTest, getConfigurationShouldPass) {

    ConfigurationIf* pClient = confClient->getClient();
    ASSERT_FALSE(pClient == NULL);
    ASSERT_TRUE(pClient->isValid());

    // request api version
    QDBusReply<QVariantMap> replyResult;
    replyResult = pClient->GetProperties();

    ASSERT_TRUE(replyResult.isValid());

    QVariantMap map = replyResult.value();
    EXPECT_TRUE(map.value("UpdateInterval").isValid());
    EXPECT_TRUE(map.value("SatelliteSystem").isValid());
}