~ubuntu-branches/ubuntu/wily/qtdeclarative-opensource-src/wily-proposed

« back to all changes in this revision

Viewing changes to tests/auto/quick/qquickxmllistmodel/tst_qquickxmllistmodel.cpp

  • Committer: Package Import Robot
  • Author(s): Ricardo Salveti de Araujo, Ricardo Salveti de Araujo, Timo Jyrinki
  • Date: 2014-06-19 02:39:21 UTC
  • mfrom: (0.1.18 experimental)
  • Revision ID: package-import@ubuntu.com-20140619023921-yb2oasnuetz9b0fc
Tags: 5.3.0-3ubuntu4
[ Ricardo Salveti de Araujo ]
* debian/control:
  - Updating dependencies as we now also have libqt5quickwidgets5-gles
* libqt5quickwidgets5.symbols: updating to allow gles variant

[ Timo Jyrinki ]
* Update libqt5quickparticles5.symbols from build logs

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
#include <QtCore/qtimer.h>
52
52
#include <QtCore/qfile.h>
53
53
#include <QtCore/qtemporaryfile.h>
 
54
#include <QtCore/qsortfilterproxymodel.h>
54
55
#include "../../shared/util.h"
55
56
#include <private/qqmlengine_p.h>
56
57
 
106
107
    void selectAncestor();
107
108
 
108
109
    void roleCrash();
 
110
    void proxyCrash();
109
111
 
110
112
private:
111
113
    QString errorString(QAbstractItemModel *model) {
744
746
    QQmlComponent component(&engine, testFileUrl("roleKeys.qml"));
745
747
    QAbstractItemModel *model = qobject_cast<QAbstractItemModel *>(component.create());
746
748
    QVERIFY(model != 0);
747
 
    
 
749
 
748
750
    QString xml;
749
 
    
 
751
 
750
752
    xml = makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics");
751
753
    model->setProperty("xml",xml);
752
754
    QTRY_COMPARE(model->rowCount(), 2);
820
822
    QQmlComponent component(&engine, testFileUrl("roleKeys.qml"));
821
823
 
822
824
    QAbstractItemModel *m1 = qobject_cast<QAbstractItemModel *>(component.create());
823
 
    QVERIFY(m1 != 0); 
 
825
    QVERIFY(m1 != 0);
824
826
    QAbstractItemModel *m2 = qobject_cast<QAbstractItemModel *>(component.create());
825
 
    QVERIFY(m2 != 0); 
 
827
    QVERIFY(m2 != 0);
826
828
    QAbstractItemModel *m3 = qobject_cast<QAbstractItemModel *>(component.create());
827
 
    QVERIFY(m3 != 0); 
 
829
    QVERIFY(m3 != 0);
828
830
 
829
831
    for (int dataCount=0; dataCount<xmlDataCount; dataCount++) {
830
832
 
988
990
    delete model;
989
991
}
990
992
 
 
993
class SortFilterProxyModel : public QSortFilterProxyModel
 
994
{
 
995
    Q_OBJECT
 
996
    Q_PROPERTY(QObject *source READ source WRITE setSource)
 
997
 
 
998
public:
 
999
    SortFilterProxyModel(QObject *parent = 0) : QSortFilterProxyModel(parent) { sort(0); }
 
1000
    QObject *source() const { return sourceModel(); }
 
1001
    void setSource(QObject *source) { setSourceModel(qobject_cast<QAbstractItemModel *>(source)); }
 
1002
};
 
1003
 
 
1004
void tst_qquickxmllistmodel::proxyCrash()
 
1005
{
 
1006
    qmlRegisterType<SortFilterProxyModel>("SortFilterProxyModel", 1, 0, "SortFilterProxyModel");
 
1007
 
 
1008
    // don't crash
 
1009
    QQmlComponent component(&engine, testFileUrl("proxyCrash.qml"));
 
1010
    QAbstractItemModel *model = qobject_cast<QAbstractItemModel *>(component.create());
 
1011
    QVERIFY(model != 0);
 
1012
    delete model;
 
1013
}
 
1014
 
991
1015
QTEST_MAIN(tst_qquickxmllistmodel)
992
1016
 
993
1017
#include "tst_qquickxmllistmodel.moc"