373 // ----------------------------------------------------------------------------- |
376 // ----------------------------------------------------------------------------- |
374 // testLoadSortingValues |
377 // testLoadSortingValues |
375 // ----------------------------------------------------------------------------- |
378 // ----------------------------------------------------------------------------- |
376 // |
379 // |
377 void TestVideoVideoCollectionViewUtils::testLoadSortingValues() |
380 void TestVideoVideoCollectionViewUtils::testLoadSortingValues() |
378 { |
381 { |
|
382 CRepository::setSetFail(255); |
|
383 |
379 CRepository::mSortValues[KVideoSortingRoleKey] = VideoCollectionCommon::KeyDateTime; |
384 CRepository::mSortValues[KVideoSortingRoleKey] = VideoCollectionCommon::KeyDateTime; |
380 CRepository::mSortValues[KVideoSortingOrderKey] = Qt::DescendingOrder; |
385 CRepository::mSortValues[KVideoSortingOrderKey] = Qt::DescendingOrder; |
381 CRepository::mSortValues[KCollectionsSortingRoleKey] = VideoCollectionCommon::KeyTitle; |
386 CRepository::mSortValues[KCollectionsSortingRoleKey] = VideoCollectionCommon::KeyTitle; |
382 CRepository::mSortValues[KCollectionsSortingOrderKey] = Qt::DescendingOrder; |
387 CRepository::mSortValues[KCollectionsSortingOrderKey] = Qt::DescendingOrder; |
383 |
388 |
516 QVERIFY(sortOrder == Qt::DescendingOrder); |
521 QVERIFY(sortOrder == Qt::DescendingOrder); |
517 |
522 |
518 } |
523 } |
519 |
524 |
520 // ----------------------------------------------------------------------------- |
525 // ----------------------------------------------------------------------------- |
521 // testGetServiceIconStrings |
526 // testGetCenRepStringValue |
522 // ----------------------------------------------------------------------------- |
527 // ----------------------------------------------------------------------------- |
523 // |
528 // |
524 void TestVideoVideoCollectionViewUtils::testGetServiceIconStrings() |
529 void TestVideoVideoCollectionViewUtils::testGetCenRepStringValue() |
525 { |
530 { |
526 VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance()); |
531 VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance()); |
527 CRepository::setNewLLeave(true); |
532 |
528 _LIT(KExpectedTDesValue, "expected"); |
533 // Invalid |
529 CRepository::setTDesValue(KExpectedTDesValue()); |
534 XQSettingsManager::mReadItemValueReturnValue = QVariant(); |
530 QString expected((QChar*)KExpectedTDesValue().Ptr(),KExpectedTDesValue().Length()); |
535 QVERIFY(testObject.getCenRepStringValue(0) == ""); |
531 |
536 |
532 QString icon; |
537 // Ok |
533 QString pressed; |
538 XQSettingsManager::mReadItemValueReturnValue = QVariant("test"); |
534 QVERIFY(testObject.getServiceIconStrings(icon, pressed) < 0); |
539 QVERIFY(testObject.getCenRepStringValue(0) == "test"); |
535 QVERIFY(icon.isNull()); |
540 } |
536 QVERIFY(pressed.isNull()); |
541 |
537 |
542 // ----------------------------------------------------------------------------- |
538 CRepository::setNewLLeave(false); |
543 // testGetCenRepIntValue |
539 CRepository::setGetFail(0); |
544 // ----------------------------------------------------------------------------- |
540 QVERIFY(testObject.getServiceIconStrings(icon, pressed) < 0); |
545 // |
541 QVERIFY(icon.isNull()); |
546 void TestVideoVideoCollectionViewUtils::testGetCenRepIntValue() |
542 QVERIFY(pressed.isNull()); |
547 { |
543 |
548 VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance()); |
544 CRepository::setGetFail(1); |
549 |
545 QVERIFY(testObject.getServiceIconStrings(icon, pressed) < 0); |
550 // Invalid |
546 QVERIFY(icon.isNull()); |
551 XQSettingsManager::mReadItemValueReturnValue = QVariant(); |
547 QVERIFY(pressed.isNull()); |
552 QVERIFY(testObject.getCenRepIntValue(0) == -1); |
548 |
553 |
549 CRepository::setGetFail(255); |
554 // Ok |
550 QVERIFY(testObject.getServiceIconStrings(icon, pressed) == 0); |
555 XQSettingsManager::mReadItemValueReturnValue = QVariant(13); |
551 QCOMPARE(icon, expected); |
556 QVERIFY(testObject.getCenRepIntValue(0) == 13); |
552 QCOMPARE(pressed, expected); |
|
553 } |
|
554 |
|
555 // ----------------------------------------------------------------------------- |
|
556 // testGetServiceIconStrings |
|
557 // ----------------------------------------------------------------------------- |
|
558 // |
|
559 void TestVideoVideoCollectionViewUtils::testGetServiceUriString() |
|
560 { |
|
561 VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance()); |
|
562 CRepository::setNewLLeave(true); |
|
563 _LIT(KExpectedTDesValue, "expected"); |
|
564 CRepository::setTDesValue(KExpectedTDesValue()); |
|
565 QString expected((QChar*)KExpectedTDesValue().Ptr(),KExpectedTDesValue().Length()); |
|
566 |
|
567 QVERIFY(testObject.getServiceUriString().isNull()); |
|
568 |
|
569 CRepository::setNewLLeave(false); |
|
570 CRepository::setGetFail(0); |
|
571 QVERIFY(testObject.getServiceUriString().isNull()); |
|
572 |
|
573 CRepository::setGetFail(255); |
|
574 QCOMPARE(testObject.getServiceUriString(), expected); |
|
575 } |
557 } |
576 |
558 |
577 // ----------------------------------------------------------------------------- |
559 // ----------------------------------------------------------------------------- |
578 // testInitListView |
560 // testInitListView |
579 // ----------------------------------------------------------------------------- |
561 // ----------------------------------------------------------------------------- |
639 // testSortModel |
621 // testSortModel |
640 // ----------------------------------------------------------------------------- |
622 // ----------------------------------------------------------------------------- |
641 // |
623 // |
642 void TestVideoVideoCollectionViewUtils::testSortModel() |
624 void TestVideoVideoCollectionViewUtils::testSortModel() |
643 { |
625 { |
|
626 CRepository::setGetFail(255); |
|
627 |
644 VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance()); |
628 VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance()); |
645 testObject.mVideosSortRole = -1; |
629 testObject.mVideosSortRole = -1; |
646 testObject.mVideosSortOrder = Qt::AscendingOrder; |
630 testObject.mVideosSortOrder = Qt::AscendingOrder; |
647 testObject.mCollectionsSortRole = -1; |
631 testObject.mCollectionsSortRole = -1; |
648 testObject.mCollectionsSortOrder = Qt::AscendingOrder; |
632 testObject.mCollectionsSortOrder = Qt::AscendingOrder; |