~gerboland/unity/8-refactor-wm-and-test

« back to all changes in this revision

Viewing changes to tests/mocks/LightDM/demo/InfographicModelPrivate.cpp

  • Committer: Michał Sawicz
  • Date: 2013-06-05 22:03:08 UTC
  • Revision ID: michal.sawicz@canonical.com-20130605220308-yny8fv3futtr04fg
Inital unity8 commit.

Previous history can be found at https://code.launchpad.net/~unity-team/unity/phablet

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2013 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
 * Author: Pete Woods <pete.woods@canonical.com>
 
17
 */
 
18
 
 
19
#include "../InfographicModelPrivate.h"
 
20
 
 
21
namespace QLightDM
 
22
{
 
23
 
 
24
void InfographicModelPrivate::generateFakeData()
 
25
{
 
26
    std::default_random_engine generator;
 
27
    std::normal_distribution<qreal> distribution(0.5, 0.2);
 
28
    auto rand = std::bind(distribution, generator);
 
29
 
 
30
    QVector<QColor> colours;
 
31
    colours.push_back(QColor::fromRgbF(0.3, 0.27, 0.32));
 
32
    colours.push_back(QColor::fromRgbF(0.83, 0.49, 0.58));
 
33
    colours.push_back(QColor::fromRgbF(0.63, 0.51, 0.59));
 
34
 
 
35
    colours.push_back(QColor::fromRgbF(0.28, 0.26, 0.4));
 
36
    colours.push_back(QColor::fromRgbF(0.47, 0.38, 0.56));
 
37
    colours.push_back(QColor::fromRgbF(0.69, 0.65, 0.78));
 
38
 
 
39
    colours.push_back(QColor::fromRgbF(0.32, 0.21, 0.16));
 
40
    colours.push_back(QColor::fromRgbF(0.55, 0.45, 0.32));
 
41
    colours.push_back(QColor::fromRgbF(0.85, 0.74, 0.53));
 
42
 
 
43
    colours.push_back(QColor::fromRgbF(0.25, 0.31, 0.19));
 
44
    colours.push_back(QColor::fromRgbF(0.63, 0.53, 0.3));
 
45
    colours.push_back(QColor::fromRgbF(0.89, 0.56, 0.31));
 
46
 
 
47
    InfographicColorTheme first(colours[0], colours[1], colours[2]);
 
48
    InfographicColorTheme second(colours[3], colours[4], colours[5]);
 
49
    InfographicColorTheme eighth(colours[6], colours[7], colours[8]);
 
50
    InfographicColorTheme ninth(colours[9], colours[10], colours[11]);
 
51
 
 
52
    {
 
53
        QVariantList firstMonth;
 
54
        while (firstMonth.size() < 17)
 
55
            firstMonth.push_back(QVariant(rand()));
 
56
        while (firstMonth.size() < 31)
 
57
            firstMonth.push_back(QVariant());
 
58
        QVariantList secondMonth;
 
59
        while (secondMonth.size() < 31)
 
60
            secondMonth.push_back(QVariant(rand()));
 
61
        QSharedPointer<InfographicData> data(
 
62
                new InfographicData("<b>52km</b> travelled", first, firstMonth,
 
63
                        ninth, secondMonth, this));
 
64
        m_fakeData.insert("guest", data);
 
65
    }
 
66
 
 
67
    {
 
68
        QVariantList firstMonth;
 
69
        while (firstMonth.size() < 17)
 
70
            firstMonth.push_back(QVariant(rand()));
 
71
        while (firstMonth.size() < 31)
 
72
            firstMonth.push_back(QVariant());
 
73
        QVariantList secondMonth;
 
74
        while (secondMonth.size() < 31)
 
75
            secondMonth.push_back(QVariant(rand()));
 
76
        QSharedPointer<InfographicData> data(
 
77
                new InfographicData("<b>33</b> messages today", second,
 
78
                        firstMonth, eighth, secondMonth, this));
 
79
        m_fakeData.insert("guest", data);
 
80
    }
 
81
 
 
82
    {
 
83
        QVariantList firstMonth;
 
84
        while (firstMonth.size() < 17)
 
85
            firstMonth.push_back(QVariant(rand()));
 
86
        while (firstMonth.size() < 31)
 
87
            firstMonth.push_back(QVariant());
 
88
        QVariantList secondMonth;
 
89
        while (secondMonth.size() < 31)
 
90
            secondMonth.push_back(QVariant(rand()));
 
91
        QSharedPointer<InfographicData> data(
 
92
                new InfographicData("<b>69</b> minutes talk time", eighth,
 
93
                        firstMonth, second, secondMonth, this));
 
94
        m_fakeData.insert("guest", data);
 
95
    }
 
96
}
 
97
 
 
98
}