Esempio n. 1
0
void TestProjectModel::testTakeRow()
{
    ProjectBaseItem* parent = new ProjectBaseItem( nullptr, QStringLiteral("test") );
    ProjectBaseItem* child = new ProjectBaseItem( nullptr, QStringLiteral("test"), parent );
    ProjectBaseItem* subchild = new ProjectBaseItem( nullptr, QStringLiteral("subtest"), child );

    model->appendRow( parent );

    QCOMPARE( parent->model(), model );
    QCOMPARE( child->model(), model );
    QCOMPARE( subchild->model(), model );

    parent->takeRow( child->row() );

    QCOMPARE( child->model(), static_cast<ProjectModel*>(nullptr) );
    QCOMPARE( subchild->model(), static_cast<ProjectModel*>(nullptr) );
}