Ejemplo n.º 1
0
void tst_QQuickAccessible::cleanup()
{
    const EventList list = QTestAccessibility::events();
    if (!list.isEmpty()) {
        qWarning("%d accessibility event(s) were not handled in testfunction '%s':", list.count(),
                 QString(QTest::currentTestFunction()).toLatin1().constData());
        for (int i = 0; i < list.count(); ++i)
            qWarning(" %d: Object: %p Event: '%s' Child: %d", i + 1, list.at(i)->object(),
                     qAccessibleEventString(list.at(i)->type()), list.at(i)->child());
    }
    QTestAccessibility::clearEvents();
}
Ejemplo n.º 2
0
void SqLiteStorageTests::deleteTaskWithEventsTest()
{
    // make a task
    const int TaskId = 1;
    const QString Task1Name( "Task-Name" );
    Task task;
    task.setId( TaskId );
    task.setName( Task1Name );
    task.setValidFrom( QDateTime::currentDateTime() );
    QVERIFY( m_storage->deleteAllTasks() );
    QVERIFY( m_storage->deleteAllEvents() );
    QVERIFY( m_storage->getAllTasks().size() == 0 );
    QVERIFY( m_storage->addTask( task ) );
    QVERIFY( m_storage->getAllTasks().size() == 1 );
    Task task2;
    task2.setId( 2 );
    task2.setName( "Task-2-Name" );
    QVERIFY( m_storage->addTask( task2 ) );
    QVERIFY( m_storage->getAllTasks().size() == 2 );

    // create 3 events, 2 for task 1, and one for another one
    {
        Event event = m_storage->makeEvent();
        QVERIFY( event.isValid() );
        event.setTaskId( task.id() );
        event.setUserId( 1 );
        event.setReportId( 42 );
        const QString EventComment( "Event-Comment" );
        event.setComment( EventComment );
        QVERIFY( m_storage->modifyEvent( event ) );
    }
    {
        Event event = m_storage->makeEvent();
        QVERIFY( event.isValid() );
        event.setTaskId( task.id() );
        event.setUserId( 1 );
        event.setReportId( 43 );
        const QString EventComment( "Event-Comment 2" );
        event.setComment( EventComment );
        QVERIFY( m_storage->modifyEvent( event ) );
    }
    // this is the event that is supposed to remain in the DB:
    Event event = m_storage->makeEvent();
    QVERIFY( event.isValid() );
    event.setTaskId( task2.id() );
    event.setUserId( 1 );
    event.setReportId( 43 );
    const QString EventComment( "Event-Comment 2" );
    event.setComment( EventComment );
    QVERIFY( m_storage->modifyEvent( event ) );

    // verify task database entries
    QVERIFY( m_storage->deleteTask( task ) );
    EventList events = m_storage->getAllEvents();
    QVERIFY( events.count() == 1 );
    QVERIFY( events.first() == event );
}