tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
child 37 758a864f9613
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
    45 #include <private/qdeclarativerectangle_p.h>
    45 #include <private/qdeclarativerectangle_p.h>
    46 #include <private/qdeclarativepositioners_p.h>
    46 #include <private/qdeclarativepositioners_p.h>
    47 #include <private/qdeclarativetransition_p.h>
    47 #include <private/qdeclarativetransition_p.h>
    48 #include <qdeclarativeexpression.h>
    48 #include <qdeclarativeexpression.h>
    49 #include "../../../shared/util.h"
    49 #include "../../../shared/util.h"
       
    50 
       
    51 #ifdef Q_OS_SYMBIAN
       
    52 // In Symbian OS test data is located in applications private dir
       
    53 #define SRCDIR "."
       
    54 #endif
    50 
    55 
    51 class tst_QDeclarativePositioners : public QObject
    56 class tst_QDeclarativePositioners : public QObject
    52 {
    57 {
    53     Q_OBJECT
    58     Q_OBJECT
    54 public:
    59 public:
    68     void test_grid_zero_columns();
    73     void test_grid_zero_columns();
    69     void test_propertychanges();
    74     void test_propertychanges();
    70     void test_repeater();
    75     void test_repeater();
    71     void test_flow();
    76     void test_flow();
    72     void test_flow_resize();
    77     void test_flow_resize();
       
    78     void test_flow_implicit_resize();
    73     void test_conflictinganchors();
    79     void test_conflictinganchors();
    74 private:
    80 private:
    75     QDeclarativeView *createView(const QString &filename);
    81     QDeclarativeView *createView(const QString &filename);
    76 };
    82 };
    77 
    83 
   648     QCOMPARE(five->y(), 50.0);
   654     QCOMPARE(five->y(), 50.0);
   649 
   655 
   650     delete canvas;
   656     delete canvas;
   651 }
   657 }
   652 
   658 
       
   659 void tst_QDeclarativePositioners::test_flow_implicit_resize()
       
   660 {
       
   661     QDeclarativeView *canvas = createView(SRCDIR "/data/flow-testimplicitsize.qml");
       
   662     QVERIFY(canvas->rootObject() != 0);
       
   663 
       
   664     QDeclarativeFlow *flow = canvas->rootObject()->findChild<QDeclarativeFlow*>("flow");
       
   665     QVERIFY(flow != 0);
       
   666 
       
   667     QCOMPARE(flow->width(), 100.0);
       
   668     QCOMPARE(flow->height(), 120.0);
       
   669 
       
   670     canvas->rootObject()->setProperty("leftToRight", true);
       
   671     QCOMPARE(flow->width(), 220.0);
       
   672     QCOMPARE(flow->height(), 50.0);
       
   673 
       
   674     canvas->rootObject()->setProperty("leftToRight", false);
       
   675     QCOMPARE(flow->width(), 100.0);
       
   676     QCOMPARE(flow->height(), 120.0);
       
   677 
       
   678     delete canvas;
       
   679 }
       
   680 
   653 QString warningMessage;
   681 QString warningMessage;
   654 
   682 
   655 void interceptWarnings(QtMsgType type, const char *msg)
   683 void interceptWarnings(QtMsgType type, const char *msg)
   656 {
   684 {
   657     Q_UNUSED( type );
   685     Q_UNUSED( type );