tests/auto/qvariant/tst_qvariant.cpp
branchRCL_3
changeset 7 3f74d0d4af4c
parent 4 3b1da2848fc7
equal deleted inserted replaced
6:dee5afe5301f 7:3f74d0d4af4c
  1966         hash2.insert( "X", 1 );
  1966         hash2.insert( "X", 1 );
  1967         hash2.insert( "Y", 1 );
  1967         hash2.insert( "Y", 1 );
  1968 
  1968 
  1969         QTest::newRow("HashSecondLarger") << QVariant(hash1) << QVariant(hash2) << false;
  1969         QTest::newRow("HashSecondLarger") << QVariant(hash1) << QVariant(hash2) << false;
  1970     }
  1970     }
       
  1971 
       
  1972     QTest::newRow( "UserType" ) << QVariant(QVariant::UserType) << QVariant(QVariant::UserType) << true;
       
  1973     QVariant mUserType(QVariant::UserType);
       
  1974     QTest::newRow( "Shared UserType" ) << mUserType << mUserType << true;
  1971 }
  1975 }
  1972 
  1976 
  1973 void tst_QVariant::operator_eq_eq()
  1977 void tst_QVariant::operator_eq_eq()
  1974 {
  1978 {
  1975     QFETCH( QVariant, left );
  1979     QFETCH( QVariant, left );
  3198     bool operator==(const MyPrimitive &o) const
  3202     bool operator==(const MyPrimitive &o) const
  3199     {
  3203     {
  3200         return x == o.x && y == o.y;
  3204         return x == o.x && y == o.y;
  3201     }
  3205     }
  3202 };
  3206 };
       
  3207 
       
  3208 QT_BEGIN_NAMESPACE
  3203 Q_DECLARE_TYPEINFO(MyPrimitive, Q_PRIMITIVE_TYPE);
  3209 Q_DECLARE_TYPEINFO(MyPrimitive, Q_PRIMITIVE_TYPE);
       
  3210 QT_END_NAMESPACE
  3204 
  3211 
  3205 struct MyData
  3212 struct MyData
  3206 {
  3213 {
  3207     void *ptr;
  3214     void *ptr;
  3208     MyData() : ptr(this) {}
  3215     MyData() : ptr(this) {}
  3237 };
  3244 };
  3238 
  3245 
  3239 int MyMovable::count  = 0;
  3246 int MyMovable::count  = 0;
  3240 
  3247 
  3241 
  3248 
       
  3249 QT_BEGIN_NAMESPACE
  3242 Q_DECLARE_TYPEINFO(MyMovable, Q_MOVABLE_TYPE);
  3250 Q_DECLARE_TYPEINFO(MyMovable, Q_MOVABLE_TYPE);
       
  3251 QT_END_NAMESPACE
  3243 
  3252 
  3244 Q_DECLARE_METATYPE(QList<QSize>)
  3253 Q_DECLARE_METATYPE(QList<QSize>)
  3245 Q_DECLARE_METATYPE(MyPrimitive)
  3254 Q_DECLARE_METATYPE(MyPrimitive)
  3246 Q_DECLARE_METATYPE(MyData)
  3255 Q_DECLARE_METATYPE(MyData)
  3247 Q_DECLARE_METATYPE(MyMovable)
  3256 Q_DECLARE_METATYPE(MyMovable)