@@ -675,9 +675,7 @@ void DesktopLOKTest::testPaintTile()
675
675
void DesktopLOKTest::testSaveAs ()
676
676
{
677
677
LibLODocument_Impl* pDocument = loadDoc (" blank_text.odt" );
678
- utl::TempFileNamed aTempFile;
679
- aTempFile.EnableKillingFile ();
680
- CPPUNIT_ASSERT (pDocument->pClass ->saveAs (pDocument, aTempFile.GetURL ().toUtf8 ().getStr (), " png" , nullptr ));
678
+ CPPUNIT_ASSERT (pDocument->pClass ->saveAs (pDocument, maTempFile.GetURL ().toUtf8 ().getStr (), " png" , nullptr ));
681
679
}
682
680
683
681
void DesktopLOKTest::testSaveAsJsonOptions ()
@@ -686,21 +684,12 @@ void DesktopLOKTest::testSaveAsJsonOptions()
686
684
LibLODocument_Impl* pDocument = loadDoc (" 3page.odg" );
687
685
688
686
// When exporting that document to PDF, skipping the first page:
689
- utl::TempFileNamed aTempFile;
690
- aTempFile.EnableKillingFile ();
691
687
OString aOptions (" {\" PageRange\" :{\" type\" :\" string\" ,\" value\" :\" 2-\" }}" );
692
- CPPUNIT_ASSERT (pDocument->pClass ->saveAs (pDocument, aTempFile .GetURL ().toUtf8 ().getStr (), " pdf" , aOptions.getStr ()));
688
+ CPPUNIT_ASSERT (pDocument->pClass ->saveAs (pDocument, maTempFile .GetURL ().toUtf8 ().getStr (), " pdf" , aOptions.getStr ()));
693
689
694
690
// Then make sure the resulting PDF has 2 pages:
695
- SvFileStream aFile (aTempFile.GetURL (), StreamMode::READ);
696
- SvMemoryStream aMemory;
697
- aMemory.WriteStream (aFile);
698
- std::shared_ptr<vcl::pdf::PDFium> pPDFium = vcl::pdf::PDFiumLibrary::get ();
699
- if (!pPDFium)
700
- return ;
701
691
std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument
702
- = pPDFium->openDocument (aMemory.GetData (), aMemory.GetSize (), OString ());
703
- CPPUNIT_ASSERT (pPdfDocument);
692
+ = parsePDFExport ();
704
693
// Without the accompanying fix in place, this test would have failed with:
705
694
// - Expected: 2
706
695
// - Actual : 3
@@ -711,9 +700,7 @@ void DesktopLOKTest::testSaveAsJsonOptions()
711
700
void DesktopLOKTest::testSaveAsCalc ()
712
701
{
713
702
LibLODocument_Impl* pDocument = loadDoc (" search.ods" );
714
- utl::TempFileNamed aTempFile;
715
- aTempFile.EnableKillingFile ();
716
- CPPUNIT_ASSERT (pDocument->pClass ->saveAs (pDocument, aTempFile.GetURL ().toUtf8 ().getStr (), " png" , nullptr ));
703
+ CPPUNIT_ASSERT (pDocument->pClass ->saveAs (pDocument, maTempFile.GetURL ().toUtf8 ().getStr (), " png" , nullptr ));
717
704
}
718
705
719
706
void DesktopLOKTest::testPasteWriter ()
@@ -2725,12 +2712,10 @@ void DesktopLOKTest::testInsertCertificate_DER_ODT()
2725
2712
{
2726
2713
// Load the document, save it into a temp file and load that file again
2727
2714
LibLODocument_Impl* pDocument = loadDoc (" blank_text.odt" );
2728
- utl::TempFileNamed aTempFile;
2729
- aTempFile.EnableKillingFile ();
2730
- CPPUNIT_ASSERT (pDocument->pClass ->saveAs (pDocument, aTempFile.GetURL ().toUtf8 ().getStr (), " odt" , nullptr ));
2715
+ CPPUNIT_ASSERT (pDocument->pClass ->saveAs (pDocument, maTempFile.GetURL ().toUtf8 ().getStr (), " odt" , nullptr ));
2731
2716
closeDoc ();
2732
2717
2733
- pDocument = loadDocUrl (aTempFile .GetURL (), LOK_DOCTYPE_TEXT);
2718
+ pDocument = loadDocUrl (maTempFile .GetURL (), LOK_DOCTYPE_TEXT);
2734
2719
2735
2720
Scheduler::ProcessEventsToIdle ();
2736
2721
CPPUNIT_ASSERT (mxComponent.is ());
@@ -2775,12 +2760,10 @@ void DesktopLOKTest::testInsertCertificate_PEM_ODT()
2775
2760
{
2776
2761
// Load the document, save it into a temp file and load that file again
2777
2762
LibLODocument_Impl* pDocument = loadDoc (" blank_text.odt" );
2778
- utl::TempFileNamed aTempFile;
2779
- aTempFile.EnableKillingFile ();
2780
- CPPUNIT_ASSERT (pDocument->pClass ->saveAs (pDocument, aTempFile.GetURL ().toUtf8 ().getStr (), " odt" , nullptr ));
2763
+ CPPUNIT_ASSERT (pDocument->pClass ->saveAs (pDocument, maTempFile.GetURL ().toUtf8 ().getStr (), " odt" , nullptr ));
2781
2764
closeDoc ();
2782
2765
2783
- pDocument = loadDocUrl (aTempFile .GetURL (), LOK_DOCTYPE_TEXT);
2766
+ pDocument = loadDocUrl (maTempFile .GetURL (), LOK_DOCTYPE_TEXT);
2784
2767
2785
2768
Scheduler::ProcessEventsToIdle ();
2786
2769
CPPUNIT_ASSERT (mxComponent.is ());
@@ -2832,12 +2815,10 @@ void DesktopLOKTest::testInsertCertificate_PEM_DOCX()
2832
2815
{
2833
2816
// Load the document, save it into a temp file and load that file again
2834
2817
LibLODocument_Impl* pDocument = loadDoc (" blank_text.docx" );
2835
- utl::TempFileNamed aTempFile;
2836
- aTempFile.EnableKillingFile ();
2837
- CPPUNIT_ASSERT (pDocument->pClass ->saveAs (pDocument, aTempFile.GetURL ().toUtf8 ().getStr (), " docx" , nullptr ));
2818
+ CPPUNIT_ASSERT (pDocument->pClass ->saveAs (pDocument, maTempFile.GetURL ().toUtf8 ().getStr (), " docx" , nullptr ));
2838
2819
closeDoc ();
2839
2820
2840
- pDocument = loadDocUrl (aTempFile .GetURL (), LOK_DOCTYPE_TEXT);
2821
+ pDocument = loadDocUrl (maTempFile .GetURL (), LOK_DOCTYPE_TEXT);
2841
2822
2842
2823
Scheduler::ProcessEventsToIdle ();
2843
2824
CPPUNIT_ASSERT (mxComponent.is ());
@@ -2889,8 +2870,6 @@ void DesktopLOKTest::testSignDocument_PEM_PDF()
2889
2870
{
2890
2871
// Load the document, save it into a temp file and load that file again
2891
2872
LibLODocument_Impl* pDocument = loadDoc (" blank_text.odt" );
2892
- utl::TempFileNamed aTempFile;
2893
- aTempFile.EnableKillingFile ();
2894
2873
2895
2874
Scheduler::ProcessEventsToIdle ();
2896
2875
CPPUNIT_ASSERT (mxComponent.is ());
@@ -2924,7 +2903,7 @@ void DesktopLOKTest::testSignDocument_PEM_PDF()
2924
2903
CPPUNIT_ASSERT (bResult);
2925
2904
}
2926
2905
2927
- CPPUNIT_ASSERT (pDocument->pClass ->saveAs (pDocument, aTempFile .GetURL ().toUtf8 ().getStr (), " pdf" , nullptr ));
2906
+ CPPUNIT_ASSERT (pDocument->pClass ->saveAs (pDocument, maTempFile .GetURL ().toUtf8 ().getStr (), " pdf" , nullptr ));
2928
2907
2929
2908
closeDoc ();
2930
2909
@@ -2934,7 +2913,7 @@ void DesktopLOKTest::testSignDocument_PEM_PDF()
2934
2913
readFileIntoByteVector (u" test-PK-signing.pem" , aPrivateKey);
2935
2914
2936
2915
LibLibreOffice_Impl aOffice;
2937
- bool bResult = aOffice.m_pOfficeClass ->signDocument (&aOffice, aTempFile .GetURL ().toUtf8 ().getStr (),
2916
+ bool bResult = aOffice.m_pOfficeClass ->signDocument (&aOffice, maTempFile .GetURL ().toUtf8 ().getStr (),
2938
2917
aCertificate.data (), int (aCertificate.size ()),
2939
2918
aPrivateKey.data (), int (aPrivateKey.size ()));
2940
2919
@@ -3096,13 +3075,11 @@ void DesktopLOKTest::testCalcSaveAs()
3096
3075
Scheduler::ProcessEventsToIdle ();
3097
3076
3098
3077
// Save as a new file.
3099
- utl::TempFileNamed aTempFile;
3100
- aTempFile.EnableKillingFile ();
3101
- pDocument->pClass ->saveAs (pDocument, aTempFile.GetURL ().toUtf8 ().getStr (), " ods" , nullptr );
3078
+ pDocument->pClass ->saveAs (pDocument, maTempFile.GetURL ().toUtf8 ().getStr (), " ods" , nullptr );
3102
3079
closeDoc ();
3103
3080
3104
3081
// Load the new document and verify that the in-flight changes are saved.
3105
- pDocument = loadDocUrl (aTempFile .GetURL (), LOK_DOCTYPE_SPREADSHEET);
3082
+ pDocument = loadDocUrl (maTempFile .GetURL (), LOK_DOCTYPE_SPREADSHEET);
3106
3083
CPPUNIT_ASSERT (pDocument);
3107
3084
3108
3085
ViewCallback aView (pDocument);
0 commit comments