@@ -11,27 +11,26 @@ import XCTest
1111@testable import OpenDocumentReader
1212
1313class OpenDocumentReaderTests : XCTestCase {
14-
1514 // ONLINE fails on GitHub Actions for some reason
1615 private let ONLINE = false
17-
16+
1817 private var saveURL : URL ?
1918
2019 override func setUpWithError( ) throws {
2120 var fileURL : URL ?
22-
21+
2322 let documentsURL = try
2423 FileManager . default. url ( for: . documentDirectory,
2524 in: . userDomainMask,
2625 appropriateFor: nil ,
2726 create: false )
28-
27+
2928 saveURL = documentsURL. appendingPathComponent ( " test.odt " )
30-
29+
3130 if ( FileManager . default. fileExists ( atPath: saveURL!. path) ) {
3231 return
3332 }
34-
33+
3534 if ( ONLINE) {
3635 let url = URL ( string: " https://api.libreoffice.org/examples/cpp/DocumentLoader/test.odt " )
3736
@@ -45,25 +44,26 @@ class OpenDocumentReaderTests: XCTestCase {
4544 let filePath = Bundle ( for: type ( of: self ) ) . path ( forResource: " test " , ofType: " odt " )
4645 fileURL = URL ( fileURLWithPath: filePath!)
4746 }
48-
47+
4948 try FileManager . default. moveItem ( at: fileURL!, to: self . saveURL!)
5049 }
5150
5251 func testExample( ) throws {
5352 measure {
5453 let coreWrapper = CoreWrapper ( )
55-
56- var translatePath = URL ( fileURLWithPath: NSTemporaryDirectory ( ) )
57- translatePath. appendPathComponent ( " translate.html " )
58-
59- coreWrapper. translate ( saveURL? . path, into: translatePath. path, with: nil , editable: true )
54+
55+ var cachePath = URL ( fileURLWithPath: NSTemporaryDirectory ( ) )
56+ var outputPath = URL ( fileURLWithPath: NSTemporaryDirectory ( ) )
57+ outputPath. appendPathComponent ( " translate.html " )
58+
59+ coreWrapper. translate ( saveURL? . path, cache: cachePath. path, into: outputPath. path, with: nil , editable: true )
6060 XCTAssertNil ( coreWrapper. errorCode)
61-
61+
6262 var backTranslatePath = URL ( fileURLWithPath: NSTemporaryDirectory ( ) )
6363 backTranslatePath. appendPathComponent ( " backtranslate.html " )
64-
64+
6565 let diff = " { \" modifiedText \" :{ \" /child:3/child:0 \" : \" This is a simple test document to demonstrate the DocumentLoaderwwww example! \" }} "
66-
66+
6767 coreWrapper. backTranslate ( diff, into: backTranslatePath. path)
6868 XCTAssertNil ( coreWrapper. errorCode)
6969 }
0 commit comments