qtmobility/tests/auto/testqgeosatelliteinfosource.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 11 06b8e2af4411
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
   148 {
   148 {
   149 }
   149 }
   150 
   150 
   151 void TestQGeoSatelliteInfoSource::test_slot2()
   151 void TestQGeoSatelliteInfoSource::test_slot2()
   152 {
   152 {
   153 	m_testSlot2Called = true;
   153     m_testSlot2Called = true;
   154 }
   154 }
   155 
   155 
   156 void TestQGeoSatelliteInfoSource::constructor_withParent()
   156 void TestQGeoSatelliteInfoSource::constructor_withParent()
   157 {
   157 {
   158     QLocationTestUtils::uheap_mark();
   158     //QLocationTestUtils::uheap_mark();
   159     QObject *parent = new QObject();
   159     QObject *parent = new QObject();
   160     new MySatelliteSource(parent);
   160     new MySatelliteSource(parent);
   161     delete parent;
   161     delete parent;
   162     QLocationTestUtils::uheap_mark_end();
   162     //QLocationTestUtils::uheap_mark_end();
   163 }
   163 }
   164 
   164 
   165 void TestQGeoSatelliteInfoSource::constructor_noParent()
   165 void TestQGeoSatelliteInfoSource::constructor_noParent()
   166 {
   166 {
   167     QLocationTestUtils::uheap_mark();
   167     //QLocationTestUtils::uheap_mark();
   168     MySatelliteSource *obj = new MySatelliteSource();
   168     MySatelliteSource *obj = new MySatelliteSource();
   169     delete obj;
   169     delete obj;
   170     QLocationTestUtils::uheap_mark_end();
   170     //QLocationTestUtils::uheap_mark_end();
   171 }
   171 }
   172 
   172 
   173 void TestQGeoSatelliteInfoSource::createDefaultSource()
   173 void TestQGeoSatelliteInfoSource::createDefaultSource()
   174 {
   174 {
   175     QLocationTestUtils::uheap_mark();
   175     //QLocationTestUtils::uheap_mark();
   176     QObject *parent = new QObject;
   176     QObject *parent = new QObject;
   177 
   177 
   178     QGeoSatelliteInfoSource *source = QGeoSatelliteInfoSource::createDefaultSource(parent);
   178     QGeoSatelliteInfoSource *source = QGeoSatelliteInfoSource::createDefaultSource(parent);
   179 #if defined(Q_OS_SYMBIAN)
   179 #if defined(Q_OS_SYMBIAN)
   180     QVERIFY(source != 0);
   180     QVERIFY(source != 0);
   181 #elif defined(Q_OS_WINCE)
   181 #elif defined(Q_OS_WINCE)
   182     QVERIFY(source != 0);
   182     QVERIFY(source != 0);
   183 #else
   183 #elif defined(Q_WS_MAEMO_5)
       
   184     QVERIFY(source != 0);
       
   185 #else    
   184     QVERIFY(source == 0);
   186     QVERIFY(source == 0);
   185 #endif
   187 #endif
   186     delete parent;
   188     delete parent;
   187     QLocationTestUtils::uheap_mark_end();
   189     //QLocationTestUtils::uheap_mark_end();
   188 }
   190 }
   189 
   191 
   190 void TestQGeoSatelliteInfoSource::createDefaultSource_noParent()
   192 void TestQGeoSatelliteInfoSource::createDefaultSource_noParent()
   191 {
   193 {
   192     QLocationTestUtils::uheap_mark();
   194     //QLocationTestUtils::uheap_mark();
   193 
   195 
   194     QGeoSatelliteInfoSource *source = QGeoSatelliteInfoSource::createDefaultSource(0);
   196     QGeoSatelliteInfoSource *source = QGeoSatelliteInfoSource::createDefaultSource(0);
   195 #if defined(Q_OS_SYMBIAN)
   197 #if defined(Q_OS_SYMBIAN)
   196     QVERIFY(source != 0);
   198     QVERIFY(source != 0);
   197 #elif defined(Q_OS_WINCE)
   199 #elif defined(Q_OS_WINCE)
   198     QVERIFY(source != 0);
   200     QVERIFY(source != 0);
       
   201 #elif defined(Q_WS_MAEMO_5)
       
   202     QVERIFY(source != 0);
   199 #else
   203 #else
   200     QVERIFY(source == 0);
   204     QVERIFY(source == 0);
   201 #endif
   205 #endif
   202     delete source;
   206     delete source;
   203     QLocationTestUtils::uheap_mark_end();
   207     //QLocationTestUtils::uheap_mark_end();
   204 }
   208 }
   205 
   209 
   206 void TestQGeoSatelliteInfoSource::startUpdates()
   210 void TestQGeoSatelliteInfoSource::startUpdates()
   207 {
   211 {
   208 
   212 
   477     QTRY_VERIFY_WITH_TIMEOUT((m_testSlot2Called == true), 1000);
   481     QTRY_VERIFY_WITH_TIMEOUT((m_testSlot2Called == true), 1000);
   478 }
   482 }
   479 
   483 
   480 void TestQGeoSatelliteInfoSource::removeSlotForSatellitesInUseUpdated()
   484 void TestQGeoSatelliteInfoSource::removeSlotForSatellitesInUseUpdated()
   481 {
   485 {
   482 	CHECK_SOURCE_VALID;
   486     CHECK_SOURCE_VALID;
   483 	
   487 
   484 	bool i = connect(m_source, SIGNAL(satellitesInUseUpdated(const QList<QGeoSatelliteInfo> &)), this, SLOT(test_slot1()));
   488     bool i = connect(m_source, SIGNAL(satellitesInUseUpdated(const QList<QGeoSatelliteInfo> &)), this, SLOT(test_slot1()));
   485 	QVERIFY(i == true);
   489     QVERIFY(i == true);
   486 	i = connect(m_source, SIGNAL(satellitesInUseUpdated(const QList<QGeoSatelliteInfo> &)), this, SLOT(test_slot2()));
   490     i = connect(m_source, SIGNAL(satellitesInUseUpdated(const QList<QGeoSatelliteInfo> &)), this, SLOT(test_slot2()));
   487 	QVERIFY(i == true);
   491     QVERIFY(i == true);
   488 	i = disconnect(m_source, SIGNAL(satellitesInUseUpdated(const QList<QGeoSatelliteInfo> &)), this, SLOT(test_slot1()));
   492     i = disconnect(m_source, SIGNAL(satellitesInUseUpdated(const QList<QGeoSatelliteInfo> &)), this, SLOT(test_slot1()));
   489 	QVERIFY(i == true);
   493     QVERIFY(i == true);
   490 	
   494 
   491 	m_source->requestUpdate(7000);
   495     m_source->requestUpdate(7000);
   492 
   496 
   493     EXPECT_FAIL_WINCE_SEE_MOBILITY_337;
   497     EXPECT_FAIL_WINCE_SEE_MOBILITY_337;
   494 
   498 
   495     QTRY_VERIFY_WITH_TIMEOUT((m_testSlot2Called == true), 7000);
   499     QTRY_VERIFY_WITH_TIMEOUT((m_testSlot2Called == true), 7000);
   496 }
   500 }
   497 
   501 
   498 void TestQGeoSatelliteInfoSource::removeSlotForSatellitesInViewUpdated()
   502 void TestQGeoSatelliteInfoSource::removeSlotForSatellitesInViewUpdated()
   499 {
   503 {
   500 	CHECK_SOURCE_VALID;
   504     CHECK_SOURCE_VALID;
   501 	
   505 
   502 	bool i = connect(m_source, SIGNAL(satellitesInViewUpdated(const QList<QGeoSatelliteInfo> &)), this, SLOT(test_slot1()));
   506     bool i = connect(m_source, SIGNAL(satellitesInViewUpdated(const QList<QGeoSatelliteInfo> &)), this, SLOT(test_slot1()));
   503 	QVERIFY(i == true);
   507     QVERIFY(i == true);
   504 	i = connect(m_source, SIGNAL(satellitesInViewUpdated(const QList<QGeoSatelliteInfo> &)), this, SLOT(test_slot2()));
   508     i = connect(m_source, SIGNAL(satellitesInViewUpdated(const QList<QGeoSatelliteInfo> &)), this, SLOT(test_slot2()));
   505 	QVERIFY(i == true);
   509     QVERIFY(i == true);
   506 	i = disconnect(m_source, SIGNAL(satellitesInViewUpdated(const QList<QGeoSatelliteInfo> &)), this, SLOT(test_slot1()));
   510     i = disconnect(m_source, SIGNAL(satellitesInViewUpdated(const QList<QGeoSatelliteInfo> &)), this, SLOT(test_slot1()));
   507 	QVERIFY(i == true);
   511     QVERIFY(i == true);
   508 	
   512 
   509 	m_source->requestUpdate(7000);
   513     m_source->requestUpdate(7000);
   510 
   514 
   511     EXPECT_FAIL_WINCE_SEE_MOBILITY_337;
   515     EXPECT_FAIL_WINCE_SEE_MOBILITY_337;
   512 
   516 
   513     QTRY_VERIFY_WITH_TIMEOUT((m_testSlot2Called == true), 7000);
   517     QTRY_VERIFY_WITH_TIMEOUT((m_testSlot2Called == true), 7000);
   514 }
   518 }