Commit f63aa211 authored by Albert Astals Cid's avatar Albert Astals Cid Committed by Albert Astals Cid

test: Actually do the migration instead of faking it

parent 2da30e74
......@@ -102,7 +102,11 @@ void DocumentTest::testDocdataMigration()
QCOMPARE( m_document->page( 0 )->annotations().first()->uniqueName(), QString("testannot") );
QCOMPARE( m_document->isDocdataMigrationNeeded(), true );
// Pretend the user has done the migration
// Do the migration
QTemporaryFile migratedSaveFile( QString( "%1/okrXXXXXX.pdf" ).arg( QDir::tempPath() ) );
QVERIFY( migratedSaveFile.open() );
migratedSaveFile.close();
QVERIFY( m_document->saveChanges( migratedSaveFile.fileName() ) );
m_document->docdataMigrationDone();
QCOMPARE( m_document->isDocdataMigrationNeeded(), false );
m_document->closeDocument();
......@@ -113,6 +117,12 @@ void DocumentTest::testDocdataMigration()
QCOMPARE( m_document->isDocdataMigrationNeeded(), false );
m_document->closeDocument();
// And the new file should have 1 annotation, let's check
QCOMPARE( m_document->openDocument( migratedSaveFile.fileName(), migratedSaveFile.fileName(), mime ), Okular::Document::OpenSuccess );
QCOMPARE( m_document->page( 0 )->annotations().size(), 1 );
QCOMPARE( m_document->isDocdataMigrationNeeded(), false );
m_document->closeDocument();
delete m_document;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment