Changeset View
Changeset View
Standalone View
Standalone View
autotests/libs/entitytreemodeltest.cpp
Show First 20 Lines • Show All 316 Lines • ▼ Show 20 Line(s) | 308 | { | |||
---|---|---|---|---|---|
317 | 317 | | |||
318 | m_modelSpy->startSpying(); | 318 | m_modelSpy->startSpying(); | ||
319 | serverData->setCommands(QList<FakeAkonadiServerCommand *>() << addCommand); | 319 | serverData->setCommands(QList<FakeAkonadiServerCommand *>() << addCommand); | ||
320 | 320 | | |||
321 | QList<ExpectedSignal> expectedSignals; | 321 | QList<ExpectedSignal> expectedSignals; | ||
322 | 322 | | |||
323 | expectedSignals << getExpectedSignal(RowsAboutToBeInserted, 0, 0, parentCollection, QVariantList() << addedCollection); | 323 | expectedSignals << getExpectedSignal(RowsAboutToBeInserted, 0, 0, parentCollection, QVariantList() << addedCollection); | ||
324 | expectedSignals << getExpectedSignal(RowsInserted, 0, 0, parentCollection, QVariantList() << addedCollection); | 324 | expectedSignals << getExpectedSignal(RowsInserted, 0, 0, parentCollection, QVariantList() << addedCollection); | ||
325 | //The data changed signal comes from the item fetch job that is triggered because we have ImmediatePopulation enabled | 325 | // The data changed signal comes from the item fetch job that is triggered because we have ImmediatePopulation enabled | ||
326 | expectedSignals << getExpectedSignal(DataChanged, 0, 0, parentCollection, QVariantList() << addedCollection); | 326 | expectedSignals << getExpectedSignal(DataChanged, 0, 0, parentCollection, QVariantList() << addedCollection); | ||
327 | 327 | | |||
328 | m_modelSpy->setExpectedSignals(expectedSignals); | 328 | m_modelSpy->setExpectedSignals(expectedSignals); | ||
329 | serverData->processNotifications(); | 329 | serverData->processNotifications(); | ||
330 | 330 | | |||
331 | // Give the model a change to run the event loop to process the signals. | 331 | // Give the model a chance to run the event loop to process the signals. | ||
332 | QTest::qWait(0); | 332 | QTest::qWait(0); | ||
333 | 333 | | |||
334 | QVERIFY(m_modelSpy->isEmpty()); | 334 | QVERIFY(m_modelSpy->isEmpty()); | ||
335 | } | 335 | } | ||
336 | 336 | | |||
337 | void EntityTreeModelTest::testCollectionRemoved_data() | 337 | void EntityTreeModelTest::testCollectionRemoved_data() | ||
338 | { | 338 | { | ||
339 | QTest::addColumn<QString>("serverContent"); | 339 | QTest::addColumn<QString>("serverContent"); | ||
Show All 32 Lines | 353 | { | |||
372 | QList<ExpectedSignal> expectedSignals; | 372 | QList<ExpectedSignal> expectedSignals; | ||
373 | 373 | | |||
374 | expectedSignals << getExpectedSignal(RowsAboutToBeRemoved, sourceRow, sourceRow, parentCollection, QVariantList() << removedCollection); | 374 | expectedSignals << getExpectedSignal(RowsAboutToBeRemoved, sourceRow, sourceRow, parentCollection, QVariantList() << removedCollection); | ||
375 | expectedSignals << getExpectedSignal(RowsRemoved, sourceRow, sourceRow, parentCollection , QVariantList() << removedCollection); | 375 | expectedSignals << getExpectedSignal(RowsRemoved, sourceRow, sourceRow, parentCollection , QVariantList() << removedCollection); | ||
376 | 376 | | |||
377 | m_modelSpy->setExpectedSignals(expectedSignals); | 377 | m_modelSpy->setExpectedSignals(expectedSignals); | ||
378 | serverData->processNotifications(); | 378 | serverData->processNotifications(); | ||
379 | 379 | | |||
380 | // Give the model a change to run the event loop to process the signals. | 380 | // Give the model a chance to run the event loop to process the signals. | ||
381 | QTest::qWait(0); | 381 | QTest::qWait(0); | ||
382 | 382 | | |||
383 | QVERIFY(m_modelSpy->isEmpty()); | 383 | QVERIFY(m_modelSpy->isEmpty()); | ||
384 | } | 384 | } | ||
385 | 385 | | |||
386 | void EntityTreeModelTest::testCollectionChanged_data() | 386 | void EntityTreeModelTest::testCollectionChanged_data() | ||
387 | { | 387 | { | ||
388 | QTest::addColumn<QString>("serverContent"); | 388 | QTest::addColumn<QString>("serverContent"); | ||
Show All 35 Lines | 404 | { | |||
424 | 424 | | |||
425 | QList<ExpectedSignal> expectedSignals; | 425 | QList<ExpectedSignal> expectedSignals; | ||
426 | 426 | | |||
427 | expectedSignals << getExpectedSignal(DataChanged, changedRow, changedRow, parentCollection, QVariantList() << collectionName); | 427 | expectedSignals << getExpectedSignal(DataChanged, changedRow, changedRow, parentCollection, QVariantList() << collectionName); | ||
428 | 428 | | |||
429 | m_modelSpy->setExpectedSignals(expectedSignals); | 429 | m_modelSpy->setExpectedSignals(expectedSignals); | ||
430 | serverData->processNotifications(); | 430 | serverData->processNotifications(); | ||
431 | 431 | | |||
432 | // Give the model a change to run the event loop to process the signals. | 432 | // Give the model a chance to run the event loop to process the signals. | ||
433 | QTest::qWait(0); | 433 | QTest::qWait(0); | ||
434 | 434 | | |||
435 | QVERIFY(m_modelSpy->isEmpty()); | 435 | QVERIFY(m_modelSpy->isEmpty()); | ||
436 | } | 436 | } | ||
437 | 437 | | |||
438 | void EntityTreeModelTest::testItemMove_data() | 438 | void EntityTreeModelTest::testItemMove_data() | ||
439 | { | 439 | { | ||
440 | QTest::addColumn<QString>("serverContent"); | 440 | QTest::addColumn<QString>("serverContent"); | ||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | 453 | { | |||
483 | expectedSignals << getExpectedSignal(RowsAboutToBeInserted, targetRow, targetRow, targetCollection, QVariantList() << movedItem); | 483 | expectedSignals << getExpectedSignal(RowsAboutToBeInserted, targetRow, targetRow, targetCollection, QVariantList() << movedItem); | ||
484 | expectedSignals << getExpectedSignal(RowsInserted, targetRow, targetRow, targetCollection, QVariantList() << movedItem); | 484 | expectedSignals << getExpectedSignal(RowsInserted, targetRow, targetRow, targetCollection, QVariantList() << movedItem); | ||
485 | // expectedSignals << getExpectedSignal( RowsAboutToBeMoved, sourceRow, sourceRow, sourceCollection, targetRow, targetCollection, QVariantList() << movedItem ); | 485 | // expectedSignals << getExpectedSignal( RowsAboutToBeMoved, sourceRow, sourceRow, sourceCollection, targetRow, targetCollection, QVariantList() << movedItem ); | ||
486 | // expectedSignals << getExpectedSignal( RowsMoved, sourceRow, sourceRow, sourceCollection, targetRow, targetCollection, QVariantList() << movedItem ); | 486 | // expectedSignals << getExpectedSignal( RowsMoved, sourceRow, sourceRow, sourceCollection, targetRow, targetCollection, QVariantList() << movedItem ); | ||
487 | 487 | | |||
488 | m_modelSpy->setExpectedSignals(expectedSignals); | 488 | m_modelSpy->setExpectedSignals(expectedSignals); | ||
489 | serverData->processNotifications(); | 489 | serverData->processNotifications(); | ||
490 | 490 | | |||
491 | // Give the model a change to run the event loop to process the signals. | 491 | // Give the model a chance to run the event loop to process the signals. | ||
492 | QTest::qWait(0); | 492 | QTest::qWait(0); | ||
493 | 493 | | |||
494 | QVERIFY(m_modelSpy->isEmpty()); | 494 | QVERIFY(m_modelSpy->isEmpty()); | ||
495 | } | 495 | } | ||
496 | 496 | | |||
497 | void EntityTreeModelTest::testItemAdded_data() | 497 | void EntityTreeModelTest::testItemAdded_data() | ||
498 | { | 498 | { | ||
499 | QTest::addColumn<QString>("serverContent"); | 499 | QTest::addColumn<QString>("serverContent"); | ||
Show All 32 Lines | 513 | { | |||
532 | QList<ExpectedSignal> expectedSignals; | 532 | QList<ExpectedSignal> expectedSignals; | ||
533 | 533 | | |||
534 | expectedSignals << getExpectedSignal(RowsAboutToBeInserted, targetRow, targetRow, parentCollection, QVariantList() << addedItem); | 534 | expectedSignals << getExpectedSignal(RowsAboutToBeInserted, targetRow, targetRow, parentCollection, QVariantList() << addedItem); | ||
535 | expectedSignals << getExpectedSignal(RowsInserted, targetRow, targetRow, parentCollection, QVariantList() << addedItem); | 535 | expectedSignals << getExpectedSignal(RowsInserted, targetRow, targetRow, parentCollection, QVariantList() << addedItem); | ||
536 | 536 | | |||
537 | m_modelSpy->setExpectedSignals(expectedSignals); | 537 | m_modelSpy->setExpectedSignals(expectedSignals); | ||
538 | serverData->processNotifications(); | 538 | serverData->processNotifications(); | ||
539 | 539 | | |||
540 | // Give the model a change to run the event loop to process the signals. | 540 | // Give the model a chance to run the event loop to process the signals. | ||
541 | QTest::qWait(0); | 541 | QTest::qWait(0); | ||
542 | 542 | | |||
543 | QVERIFY(m_modelSpy->isEmpty()); | 543 | QVERIFY(m_modelSpy->isEmpty()); | ||
544 | } | 544 | } | ||
545 | 545 | | |||
546 | void EntityTreeModelTest::testItemRemoved_data() | 546 | void EntityTreeModelTest::testItemRemoved_data() | ||
547 | { | 547 | { | ||
548 | QTest::addColumn<QString>("serverContent"); | 548 | QTest::addColumn<QString>("serverContent"); | ||
Show All 39 Lines | 569 | { | |||
588 | QList<ExpectedSignal> expectedSignals; | 588 | QList<ExpectedSignal> expectedSignals; | ||
589 | 589 | | |||
590 | expectedSignals << getExpectedSignal(RowsAboutToBeRemoved, sourceRow, sourceRow, sourceCollection, QVariantList() << removedItem); | 590 | expectedSignals << getExpectedSignal(RowsAboutToBeRemoved, sourceRow, sourceRow, sourceCollection, QVariantList() << removedItem); | ||
591 | expectedSignals << getExpectedSignal(RowsRemoved, sourceRow, sourceRow, sourceCollection, QVariantList() << removedItem); | 591 | expectedSignals << getExpectedSignal(RowsRemoved, sourceRow, sourceRow, sourceCollection, QVariantList() << removedItem); | ||
592 | 592 | | |||
593 | m_modelSpy->setExpectedSignals(expectedSignals); | 593 | m_modelSpy->setExpectedSignals(expectedSignals); | ||
594 | serverData->processNotifications(); | 594 | serverData->processNotifications(); | ||
595 | 595 | | |||
596 | // Give the model a change to run the event loop to process the signals. | 596 | // Give the model a chance to run the event loop to process the signals. | ||
597 | QTest::qWait(0); | 597 | QTest::qWait(0); | ||
598 | 598 | | |||
599 | QVERIFY(m_modelSpy->isEmpty()); | 599 | QVERIFY(m_modelSpy->isEmpty()); | ||
600 | } | 600 | } | ||
601 | 601 | | |||
602 | void EntityTreeModelTest::testItemChanged_data() | 602 | void EntityTreeModelTest::testItemChanged_data() | ||
603 | { | 603 | { | ||
604 | QTest::addColumn<QString>("serverContent"); | 604 | QTest::addColumn<QString>("serverContent"); | ||
Show All 38 Lines | 625 | { | |||
643 | 643 | | |||
644 | QList<ExpectedSignal> expectedSignals; | 644 | QList<ExpectedSignal> expectedSignals; | ||
645 | 645 | | |||
646 | expectedSignals << getExpectedSignal(DataChanged, sourceRow, sourceRow, QVariantList() << changedItem); | 646 | expectedSignals << getExpectedSignal(DataChanged, sourceRow, sourceRow, QVariantList() << changedItem); | ||
647 | 647 | | |||
648 | m_modelSpy->setExpectedSignals(expectedSignals); | 648 | m_modelSpy->setExpectedSignals(expectedSignals); | ||
649 | serverData->processNotifications(); | 649 | serverData->processNotifications(); | ||
650 | 650 | | |||
651 | // Give the model a change to run the event loop to process the signals. | 651 | // Give the model a chance to run the event loop to process the signals. | ||
652 | QTest::qWait(0); | 652 | QTest::qWait(0); | ||
653 | 653 | | |||
654 | QVERIFY(m_modelSpy->isEmpty()); | 654 | QVERIFY(m_modelSpy->isEmpty()); | ||
655 | } | 655 | } | ||
656 | 656 | | |||
657 | void EntityTreeModelTest::testRemoveCollectionOnChanged() | 657 | void EntityTreeModelTest::testRemoveCollectionOnChanged() | ||
658 | { | 658 | { | ||
659 | const QString serverContent = QStringLiteral( | 659 | const QString serverContent = QStringLiteral( | ||
Show All 39 Lines |