test: Actually do the migration instead of faking it

remotes/origin/dont-use-docdata-for-annots-and-forms
Albert Astals Cid 8 years ago committed by Albert Astals Cid
parent 2da30e747d
commit f63aa211dc
  1. 12
      autotests/documenttest.cpp

@ -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;
}

Loading…
Cancel
Save