~ci-train-bot/ubuntu-ui-extras/ubuntu-ui-extras-ubuntu-zesty-2515

« back to all changes in this revision

Viewing changes to tests/unittests/Printers/tst_jobmodel.cpp

  • Committer: Bileto Bot
  • Author(s): Andrew Hayzen, Jonas G. Drange
  • Date: 2017-02-24 17:31:11 UTC
  • mfrom: (134.1.7 printer-components-tracing)
  • Revision ID: ci-train-bot@canonical.com-20170224173111-8ci4ms75cnrg59q3
test

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
    }
97
97
    void testModify()
98
98
    {
 
99
        qDebug() << Q_FUNC_INFO << "Create jobBefore";
 
100
 
99
101
        auto jobBefore = QSharedPointer<PrinterJob>(new PrinterJob("test-printer", m_backend, 1));
100
102
 
 
103
        qDebug() << Q_FUNC_INFO << "Add jobBefore to m_jobs";
 
104
 
101
105
        m_backend->m_jobs << jobBefore;
 
106
 
 
107
        qDebug() << Q_FUNC_INFO << "Emit mockJobCreated";
 
108
 
102
109
        m_backend->mockJobCreated("", "", "", 1, "", true, 100, 1, "", "", 1);
103
110
 
 
111
        qDebug() << Q_FUNC_INFO << "Model Count" << m_model->count();
 
112
 
 
113
        qDebug() << Q_FUNC_INFO << "Create jobAfter";
 
114
 
104
115
        auto jobAfter = QSharedPointer<PrinterJob>(new PrinterJob("test-printer", m_backend, 1));
 
116
 
 
117
        qDebug() << Q_FUNC_INFO << "Set copies value";
 
118
 
105
119
        jobAfter->setCopies(100);
 
120
 
 
121
        qDebug() << Q_FUNC_INFO << "Replace jobBefore in m_jobs with jobAfter";
 
122
 
106
123
        m_backend->m_jobs.replace(0, jobAfter);
107
124
 
 
125
        qDebug() << Q_FUNC_INFO << "Setup spy";
 
126
 
108
127
        // Triggers a change.
109
128
        QSignalSpy changedSpy(m_model, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&, const QVector<int>&)));
 
129
 
 
130
        qDebug() << Q_FUNC_INFO << "Emit mockJobCreated";
 
131
 
110
132
        m_backend->mockJobCreated("", "", "", 1, "", true, 100, 1, "", "", 1);
 
133
 
 
134
        qDebug() << Q_FUNC_INFO << "Compare spy count";
 
135
 
111
136
        QCOMPARE(changedSpy.count(), 1);
 
137
 
 
138
        qDebug() << Q_FUNC_INFO << "End";
112
139
    }
113
140
 
114
141
private: