From f63aa211dc7a75b2a2805aa017d6e855bb07ea2e Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Wed, 15 Nov 2017 12:09:17 +0100 Subject: [PATCH] test: Actually do the migration instead of faking it --- autotests/documenttest.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/autotests/documenttest.cpp b/autotests/documenttest.cpp index 4c79b2b38..4f7e2fd06 100644 --- a/autotests/documenttest.cpp +++ b/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; }