~paulliu/unity8/lp1350891_ScrollBackground

« back to all changes in this revision

Viewing changes to tests/mocks/libusermetrics/UserMetrics.cpp

  • Committer: Ying-Chun Liu
  • Date: 2015-02-13 13:27:19 UTC
  • mfrom: (1431.1.180 unity8)
  • Revision ID: paul.liu@canonical.com-20150213132719-8itxhrauv317p18p
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
289
289
                new UserMetricsData("<b>52km</b> travelled", first, firstMonth,
290
290
                        ninth, secondMonth, this));
291
291
        m_fakeData.insert("single", data);
 
292
        m_fakeData.insert("has-pin", data);
292
293
    }
293
294
 
294
295
    {
304
305
                new UserMetricsData("<b>33</b> messages today", second,
305
306
                        firstMonth, eighth, secondMonth, this));
306
307
        m_fakeData.insert("single", data);
 
308
        m_fakeData.insert("has-pin", data);
307
309
    }
308
310
 
309
311
    {
310
312
        QVariantList firstMonth;
311
313
        while (firstMonth.size() < 17)
312
314
            firstMonth.push_back(QVariant(rand()));
 
315
        firstMonth[8] = QVariant(1.0); // oversized 9th day, to test clipping
313
316
        while (firstMonth.size() < 31)
314
317
            firstMonth.push_back(QVariant());
315
318
        QVariantList secondMonth;
319
322
                new UserMetricsData("<b>19</b> minutes talk time", eighth,
320
323
                        firstMonth, second, secondMonth, this));
321
324
        m_fakeData.insert("single", data);
 
325
        m_fakeData.insert("has-pin", data);
322
326
        // Also use same data for some tablet users
323
327
        m_fakeData.insert("has-password", data);
324
328
        m_fakeData.insert("no-password", data);
386
390
    if (m_dataIndex == m_fakeData.constEnd() || m_dataIndex.key() != m_username)
387
391
    {
388
392
        m_dataIndex = m_fakeData.constFind(m_username);
 
393
        if (m_dataIndex == m_fakeData.constEnd())
 
394
        {
 
395
            m_dataIndex = m_fakeData.constFind("");
 
396
        }
389
397
    }
390
398
 
391
399
    loadFakeData();