make parttest pass again

This commit is contained in:
Albert Astals Cid 2017-10-26 21:24:09 +02:00 committed by Albert Astals Cid
parent 0cb4ff7dad
commit 8d7ea894f3
2 changed files with 5 additions and 5 deletions

View file

@ -739,7 +739,7 @@ void PartTest::testSaveAs()
// user to confirm. On the other end, if we expect annotations to be
// preserved (and thus no warning), we keep the warning on so that if it
// shows the test timeouts and we can notice that something is wrong.
const Part::SaveAsFlags saveAsNativeFlags = nativelySupportsAnnotations ?
const Part::SaveAsFlags extraSaveAsFlags = nativelySupportsAnnotations ?
Part::NoSaveAsFlags : Part::SaveAsDontShowWarning;
QString annotName;
@ -761,8 +761,8 @@ void PartTest::testSaveAs()
part.m_document->addPageAnnotation( 0, annot );
annotName = annot->uniqueName();
QVERIFY( part.saveAs( QUrl::fromLocalFile( archiveSave.fileName() ), Part::SaveAsOkularArchive ) );
QVERIFY( part.saveAs( QUrl::fromLocalFile( nativeDirectSave.fileName() ), saveAsNativeFlags ) );
QVERIFY( part.saveAs( QUrl::fromLocalFile( archiveSave.fileName() ), extraSaveAsFlags | Part::SaveAsOkularArchive ) );
QVERIFY( part.saveAs( QUrl::fromLocalFile( nativeDirectSave.fileName() ), extraSaveAsFlags ) );
part.closeUrl();
}
@ -775,7 +775,7 @@ void PartTest::testSaveAs()
QCOMPARE( part.m_document->page( 0 )->annotations().size(), 1 );
QCOMPARE( part.m_document->page( 0 )->annotations().first()->uniqueName(), annotName );
QVERIFY( part.saveAs( QUrl::fromLocalFile( nativeFromArchiveFile.fileName() ), saveAsNativeFlags ) );
QVERIFY( part.saveAs( QUrl::fromLocalFile( nativeFromArchiveFile.fileName() ), extraSaveAsFlags ) );
part.closeUrl();
}

View file

@ -2478,7 +2478,7 @@ bool Part::saveAs( const QUrl & saveUrl, SaveAsFlags flags )
// Does the user want a .okular archive?
if ( flags & SaveAsOkularArchive )
{
if ( !hasUserAcceptedReload && !m_document->canSwapBackingFile() )
if ( !hasUserAcceptedReload && !m_document->canSwapBackingFile() && !( flags & SaveAsDontShowWarning ) )
{
const int res = KMessageBox::warningYesNo( widget(),
i18n( "The current document format backend doesn't support internal reload on save so we will close and open the file again.<br />This means that the undo/redo stack will be lost.<br />Do you want to continue?" ),