Make all of our unit test to pass
This commit is contained in:
parent
e5da335fcf
commit
52fd2c12a2
3 changed files with 14 additions and 4 deletions
|
@ -60,7 +60,7 @@ EffectModel::EffectModel(QObject *parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
QModelIndex EffectModel::index(int row, int column, const QModelIndex &parent) const {
|
QModelIndex EffectModel::index(int row, int column, const QModelIndex &parent) const {
|
||||||
if (!parent.isValid() || column > 0 || row < 0 || row >= rowCount()) {
|
if (parent.isValid() || column > 0 || column < 0 || row < 0 || row >= m_effectsList.count()) {
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,6 +69,7 @@ QModelIndex EffectModel::index(int row, int column, const QModelIndex &parent) c
|
||||||
|
|
||||||
QModelIndex EffectModel::parent(const QModelIndex &child) const {
|
QModelIndex EffectModel::parent(const QModelIndex &child) const {
|
||||||
Q_UNUSED(child)
|
Q_UNUSED(child)
|
||||||
|
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,6 +78,9 @@ int EffectModel::columnCount(const QModelIndex &parent) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
int EffectModel::rowCount(const QModelIndex &parent) const {
|
int EffectModel::rowCount(const QModelIndex &parent) const {
|
||||||
|
if (parent.isValid()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return m_effectsList.count();
|
return m_effectsList.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,13 +28,18 @@ EffectModelTest::EffectModelTest(QObject *parent)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectModelTest::testModel() {
|
void EffectModelTest::testEffectModel() {
|
||||||
|
KWin::Compositing::EffectModel *effectModel = new KWin::Compositing::EffectModel();
|
||||||
|
|
||||||
|
new ModelTest(effectModel, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EffectModelTest::testEffectFilterModel() {
|
||||||
KWin::Compositing::EffectFilterModel *model = new KWin::Compositing::EffectFilterModel();
|
KWin::Compositing::EffectFilterModel *model = new KWin::Compositing::EffectFilterModel();
|
||||||
KWin::Compositing::EffectModel *effectModel = new KWin::Compositing::EffectModel();
|
KWin::Compositing::EffectModel *effectModel = new KWin::Compositing::EffectModel();
|
||||||
|
|
||||||
model->setEffectModel(effectModel);
|
model->setEffectModel(effectModel);
|
||||||
new ModelTest(model, this);
|
new ModelTest(model, this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QTEST_MAIN(EffectModelTest)
|
QTEST_MAIN(EffectModelTest)
|
||||||
|
|
|
@ -32,6 +32,7 @@ public:
|
||||||
EffectModelTest(QObject *parent = 0);
|
EffectModelTest(QObject *parent = 0);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void testModel();
|
void testEffectModel();
|
||||||
|
void testEffectFilterModel();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue