Selaa lähdekoodia

KdanAuto - SDK 转档参数动态支持,支持向后兼容

zhudongyong 1 vuosi sitten
vanhempi
commit
f686ae26e1

+ 20 - 3
KdanAutoTest/KdanAuto.xcodeproj/project.pbxproj

@@ -35,6 +35,7 @@
 		242F966F298BAE2200CFF56C /* Toggle_half.png in Resources */ = {isa = PBXBuildFile; fileRef = 242F966C298BAE2200CFF56C /* Toggle_half.png */; };
 		243DACD32940C6E8008A8AA6 /* ActivityView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 243DACD22940C6E8008A8AA6 /* ActivityView.swift */; };
 		2451F58B2952E4E50049FA9C /* ComPDFKit_Conversion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2451F58A2952E4E50049FA9C /* ComPDFKit_Conversion.framework */; };
+		2455C0D629E035A400800E8E /* PerformSelectTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 2455C0D529E035A400800E8E /* PerformSelectTool.m */; };
 		246FE591299DCFC400706586 /* PDFCompareTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 246FE590299DCFC400706586 /* PDFCompareTest.swift */; };
 		246FE5A1299E0FCD00706586 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 246FE593299E0FCC00706586 /* LICENSE */; };
 		246FE5A2299E0FCD00706586 /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 246FE596299E0FCC00706586 /* unzip.c */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
@@ -83,6 +84,7 @@
 		24DCE8B32950543C004EBA35 /* AutoTestCellInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24DCE8B22950543C004EBA35 /* AutoTestCellInfo.swift */; };
 		24DCE8B529506CDE004EBA35 /* AutoTestProperty.plist in Resources */ = {isa = PBXBuildFile; fileRef = 24DCE8B429506CDE004EBA35 /* AutoTestProperty.plist */; };
 		24DCE8BB29518FD3004EBA35 /* ProcessThumbnal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 240509B62943479800B501B2 /* ProcessThumbnal.swift */; };
+		24E3165D29DC35A20009E358 /* UpdateSDK.sh in Resources */ = {isa = PBXBuildFile; fileRef = 24E3165C29DC35A20009E358 /* UpdateSDK.sh */; };
 		24FE3FF329BAF9B8004F4DD4 /* CoreImage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 24FE3FF229BAF9B8004F4DD4 /* CoreImage.framework */; };
 /* End PBXBuildFile section */
 
@@ -159,6 +161,8 @@
 		242F966C298BAE2200CFF56C /* Toggle_half.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Toggle_half.png; sourceTree = "<group>"; };
 		243DACD22940C6E8008A8AA6 /* ActivityView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityView.swift; sourceTree = "<group>"; };
 		2451F58A2952E4E50049FA9C /* ComPDFKit_Conversion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = ComPDFKit_Conversion.framework; sourceTree = "<group>"; };
+		2455C0D429E035A400800E8E /* PerformSelectTool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PerformSelectTool.h; sourceTree = "<group>"; };
+		2455C0D529E035A400800E8E /* PerformSelectTool.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PerformSelectTool.m; sourceTree = "<group>"; };
 		246FE590299DCFC400706586 /* PDFCompareTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PDFCompareTest.swift; sourceTree = "<group>"; };
 		246FE593299E0FCC00706586 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
 		246FE594299E0FCC00706586 /* ZipArchive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZipArchive.h; sourceTree = "<group>"; };
@@ -223,6 +227,7 @@
 		24DCE8AF295047D8004EBA35 /* TestFileCellView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestFileCellView.swift; sourceTree = "<group>"; };
 		24DCE8B22950543C004EBA35 /* AutoTestCellInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutoTestCellInfo.swift; sourceTree = "<group>"; };
 		24DCE8B429506CDE004EBA35 /* AutoTestProperty.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = AutoTestProperty.plist; sourceTree = "<group>"; };
+		24E3165C29DC35A20009E358 /* UpdateSDK.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = UpdateSDK.sh; sourceTree = "<group>"; };
 		24FE3FF229BAF9B8004F4DD4 /* CoreImage.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreImage.framework; path = System/Library/Frameworks/CoreImage.framework; sourceTree = SDKROOT; };
 /* End PBXFileReference section */
 
@@ -317,6 +322,7 @@
 		240934B12992735200839CC8 /* Tools */ = {
 			isa = PBXGroup;
 			children = (
+				2455C0D329E0358800800E8E /* PerformSelectorTool */,
 				246FE592299E0FCC00706586 /* ZipArchive */,
 				240934B52992736600839CC8 /* ImageProcess */,
 				240934B22992735200839CC8 /* FileConveter */,
@@ -359,6 +365,15 @@
 			path = ActivityView;
 			sourceTree = "<group>";
 		};
+		2455C0D329E0358800800E8E /* PerformSelectorTool */ = {
+			isa = PBXGroup;
+			children = (
+				2455C0D429E035A400800E8E /* PerformSelectTool.h */,
+				2455C0D529E035A400800E8E /* PerformSelectTool.m */,
+			);
+			path = PerformSelectorTool;
+			sourceTree = "<group>";
+		};
 		246FE592299E0FCC00706586 /* ZipArchive */ = {
 			isa = PBXGroup;
 			children = (
@@ -541,6 +556,7 @@
 		24D7FFF9292B4FF500DAB5EE /* Setting */ = {
 			isa = PBXGroup;
 			children = (
+				24E3165C29DC35A20009E358 /* UpdateSDK.sh */,
 				24D7FFFA292B501100DAB5EE /* SettingViewController.swift */,
 				24D7FFFF292B6FD100DAB5EE /* SettingViewController.xib */,
 			);
@@ -755,6 +771,7 @@
 				242F966E298BAE2200CFF56C /* Toggle_on.png in Resources */,
 				246FE5A1299E0FCD00706586 /* LICENSE in Resources */,
 				24DCE8A8295046A5004EBA35 /* TestCaseCellView.xib in Resources */,
+				24E3165D29DC35A20009E358 /* UpdateSDK.sh in Resources */,
 				24D7FF9F29261A6600DAB5EE /* Assets.xcassets in Resources */,
 				24CA233C298FF0F800038E10 /* CompareViewController.xib in Resources */,
 				24DCE8B529506CDE004EBA35 /* AutoTestProperty.plist in Resources */,
@@ -815,6 +832,7 @@
 				24D70009292D14DA00DAB5EE /* AutoTestProtocal.swift in Sources */,
 				24A6FF4F2930A1E100B34F2E /* FontAutoTest.swift in Sources */,
 				24A6FF49293091E000B34F2E /* AutoTest.swift in Sources */,
+				2455C0D629E035A400800E8E /* PerformSelectTool.m in Sources */,
 				246FE5A7299E0FCD00706586 /* ZipArchive.m in Sources */,
 				24CA233A298FEED300038E10 /* FileInfo.swift in Sources */,
 				24DCE8BB29518FD3004EBA35 /* ProcessThumbnal.swift in Sources */,
@@ -1053,7 +1071,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CODE_SIGN_ENTITLEMENTS = KdanAuto/KdanAutoDebug.entitlements;
-				"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
+				"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
 				CODE_SIGN_STYLE = Manual;
 				COMBINE_HIDPI_IMAGES = YES;
 				CURRENT_PROJECT_VERSION = 20230404;
@@ -1094,10 +1112,9 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CODE_SIGN_ENTITLEMENTS = KdanAuto/KdanAuto.entitlements;
-				CODE_SIGN_STYLE = Automatic;
+				CODE_SIGN_STYLE = Manual;
 				COMBINE_HIDPI_IMAGES = YES;
 				CURRENT_PROJECT_VERSION = 20230404;
-				DEVELOPMENT_TEAM = 4GGQPGRTSV;
 				ENABLE_HARDENED_RUNTIME = YES;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",

BIN
KdanAutoTest/KdanAuto.xcodeproj/project.xcworkspace/xcuserdata/zhudongyong.xcuserdatad/UserInterfaceState.xcuserstate


+ 13 - 0
KdanAutoTest/KdanAuto/Base.lproj/Main.storyboard

@@ -133,6 +133,19 @@
                                                 <action selector="diselectAllTestItem:" target="Ady-hI-5gd" id="ua5-6J-oYL"/>
                                             </connections>
                                         </menuItem>
+                                        <menuItem isSeparatorItem="YES" id="eBb-jX-Cb6"/>
+                                        <menuItem title="清除测试缓存" id="9zc-KG-xij">
+                                            <modifierMask key="keyEquivalentModifierMask"/>
+                                            <connections>
+                                                <action selector="clearAllReportItem:" target="Ady-hI-5gd" id="gYd-kN-uSI"/>
+                                            </connections>
+                                        </menuItem>
+                                        <menuItem title="清除所有对照文件" id="SSk-6e-C2z">
+                                            <modifierMask key="keyEquivalentModifierMask"/>
+                                            <connections>
+                                                <action selector="clearAllCheckFilesItem:" target="Ady-hI-5gd" id="yDM-Rd-xox"/>
+                                            </connections>
+                                        </menuItem>
                                     </items>
                                 </menu>
                             </menuItem>

+ 38 - 4
KdanAutoTest/KdanAuto/Class/AutoTestCase/AutoTest.swift

@@ -360,7 +360,7 @@ class AutoTest : NSObject, AutoTestProtocal {
                     DispatchQueue.global().async {
                         autoreleasepool {
                             let item = items[itemIndex]
-                            NSLog("\(itemIndex):\(item)")
+//                            NSLog("\(itemIndex):\(item)")
                             let subFileName = item as! String
                             let subResultPath = NSString(string: resultDirectory).appendingPathComponent(subFileName+"."+self.extention())
                             objc_sync_enter(self)
@@ -387,7 +387,7 @@ class AutoTest : NSObject, AutoTestProtocal {
                                                 autoreleasepool {
                                                     let pathCompotent = "/"+subImageName
                                                     ImageProcess.compareJPEG(String(rComparePath+pathCompotent), checkPath: String(cComparePath+pathCompotent), processCover: true, complention: { degree in
-                                                        NSLog(String("文件夹,\(subFileName+".jpg"+pathCompotent)"))
+//                                                        NSLog(String("文件夹,\(subFileName+".jpg"+pathCompotent)"))
                                                         
                                                         TestDegreeManager.shared().set(degree, fileType: self.fileType(), type: self.type(),
                                                                                        fileName: fileName, refFilePath: subFileName+".jpg"+pathCompotent)
@@ -437,7 +437,7 @@ class AutoTest : NSObject, AutoTestProtocal {
                                         }else {
                                             // 单个文件生成单个快照文件情形
                                             ImageProcess.compareJPEG(rComparePath, checkPath: cComparePath, processCover: true, complention: { degree in
-                                                NSLog(String("非文件夹,\(subFileName+".jpg")"))
+//                                                NSLog(String("非文件夹,\(subFileName+".jpg")"))
                                                 
                                                 TestDegreeManager.shared().set(degree, fileType: self.fileType(), type: self.type(),
                                                                                fileName: fileName, refFilePath: subFileName+".jpg")
@@ -830,7 +830,41 @@ class AutoTest : NSObject, AutoTestProtocal {
         return false
     }
     
-    ///
+    // Clear
+    func clearCompareFiles() {
+        reportString = NSMutableAttributedString.init();
+        
+        let resultDirectory = self.checkFileDirectory()
+        
+        var isDirectory = ObjCBool(false)
+        if FileManager.default.fileExists(atPath: resultDirectory, isDirectory: &isDirectory) && isDirectory.boolValue {
+            let searchItems = try? FileManager.default.contentsOfDirectory(atPath: resultDirectory)
+            for item in NSArray(array: searchItems ?? []) {
+                let path = NSString(string: resultDirectory).appendingPathComponent(item as! String)
+                if FileManager.default.fileExists(atPath: path) {
+                    try? FileManager.default.removeItem(atPath:  path)
+                }
+            }
+        }
+    }
+    
+    func clearOriginFiles() {
+        reportString = NSMutableAttributedString.init();
+        
+        let resultDirectory = self.originFileDirectory()
+        
+        var isDirectory = ObjCBool(false)
+        if FileManager.default.fileExists(atPath: resultDirectory, isDirectory: &isDirectory) && isDirectory.boolValue {
+            let searchItems = try? FileManager.default.contentsOfDirectory(atPath: resultDirectory)
+            for item in NSArray(array: searchItems ?? []) {
+                let path = NSString(string: resultDirectory).appendingPathComponent(item as! String)
+                if FileManager.default.fileExists(atPath: path) {
+                    try? FileManager.default.removeItem(atPath:  path)
+                }
+            }
+        }
+    }
+    
     func clearCacheFiles() {
         reportString = NSMutableAttributedString.init();
         

+ 182 - 9
KdanAutoTest/KdanAuto/Class/AutoTestCase/AutoTestProperty.plist

@@ -44,6 +44,59 @@
 			<key>Class</key>
 			<string>AutoTest</string>
 		</dict>
+		<dict>
+			<key>Type</key>
+			<string>Others:OCR(New)</string>
+			<key>Extention</key>
+			<string>rtf</string>
+			<key>Name</key>
+			<string>快照对比:OCR(新库)</string>
+			<key>Class</key>
+			<string>AutoTest</string>
+			<key>Params</key>
+			<dict>
+				<key>Options</key>
+				<dict>
+					<key>160</key>
+					<array>
+						<dict>
+							<key>Property</key>
+							<string>isAllowOCR</string>
+							<key>Selector</key>
+							<string>setIsAllowOCR:</string>
+							<key>ValueType</key>
+							<string>BOOL</string>
+							<key>Value</key>
+							<true/>
+						</dict>
+						<dict>
+							<key>Property</key>
+							<string>language</string>
+							<key>ValueType</key>
+							<string>int</string>
+							<key>Value</key>
+							<integer>0</integer>
+						</dict>
+						<dict>
+							<key>Property</key>
+							<string>isContainAnnotations</string>
+							<key>ValueType</key>
+							<string>BOOL</string>
+							<key>Value</key>
+							<true/>
+						</dict>
+						<dict>
+							<key>Property</key>
+							<string>isContainImages</string>
+							<key>ValueType</key>
+							<string>BOOL</string>
+							<key>Value</key>
+							<true/>
+						</dict>
+					</array>
+				</dict>
+			</dict>
+		</dict>
 	</array>
 	<key>Word</key>
 	<array>
@@ -135,7 +188,7 @@
 			<key>Type</key>
 			<string>AllInOne(Old)</string>
 			<key>Name</key>
-			<string>合并导出快照对比</string>
+			<string>合并导出快照对比(Old)</string>
 			<key>Extention</key>
 			<string>csv</string>
 			<key>Class</key>
@@ -202,8 +255,20 @@
 			<string>AutoTest</string>
 			<key>Params</key>
 			<dict>
-				<key>paneOptions</key>
-				<integer>0</integer>
+				<key>Options</key>
+				<dict>
+					<key>160</key>
+					<array>
+						<dict>
+							<key>Property</key>
+							<string>paneOptions</string>
+							<key>ValueType</key>
+							<string>int</string>
+							<key>Value</key>
+							<integer>0</integer>
+						</dict>
+					</array>
+				</dict>
 			</dict>
 		</dict>
 		<dict>
@@ -217,8 +282,20 @@
 			<string>AutoTest</string>
 			<key>Params</key>
 			<dict>
-				<key>paneOptions</key>
-				<integer>2</integer>
+				<key>Options</key>
+				<dict>
+					<key>160</key>
+					<array>
+						<dict>
+							<key>Property</key>
+							<string>paneOptions</string>
+							<key>ValueType</key>
+							<string>int</string>
+							<key>Value</key>
+							<integer>2</integer>
+						</dict>
+					</array>
+				</dict>
 			</dict>
 		</dict>
 	</array>
@@ -249,6 +326,43 @@
 			<key>Class</key>
 			<string>AutoTest</string>
 		</dict>
+		<dict>
+			<key>Type</key>
+			<string>Others:OCR(New)</string>
+			<key>Extention</key>
+			<string>txt</string>
+			<key>Name</key>
+			<string>快照对比: OCR(新库)</string>
+			<key>Class</key>
+			<string>AutoTest</string>
+			<key>Params</key>
+			<dict>
+				<key>Options</key>
+				<dict>
+					<key>160</key>
+					<array>
+						<dict>
+							<key>Property</key>
+							<string>isAllowOCR</string>
+							<key>Selector</key>
+							<string>setIsAllowOCR:</string>
+							<key>ValueType</key>
+							<string>BOOL</string>
+							<key>Value</key>
+							<true/>
+						</dict>
+						<dict>
+							<key>Property</key>
+							<string>language</string>
+							<key>ValueType</key>
+							<string>int</string>
+							<key>Value</key>
+							<integer>0</integer>
+						</dict>
+					</array>
+				</dict>
+			</dict>
+		</dict>
 	</array>
 	<key>JPEG</key>
 	<array>
@@ -295,8 +409,55 @@
 			<string>AutoTest</string>
 			<key>Params</key>
 			<dict>
-				<key>imageDpi</key>
-				<integer>216</integer>
+				<key>Options</key>
+				<dict>
+					<key>160</key>
+					<array>
+						<dict>
+							<key>Property</key>
+							<string>imageDpi</string>
+							<key>ValueType</key>
+							<string>int</string>
+							<key>Value</key>
+							<string>216</string>
+						</dict>
+					</array>
+				</dict>
+			</dict>
+		</dict>
+		<dict>
+			<key>Type</key>
+			<string>Others-Anno(New)</string>
+			<key>Extention</key>
+			<string>jpg</string>
+			<key>Name</key>
+			<string>快照对比-含 Anno(新库)</string>
+			<key>Class</key>
+			<string>AutoTest</string>
+			<key>Params</key>
+			<dict>
+				<key>Options</key>
+				<dict>
+					<key>160</key>
+					<array>
+						<dict>
+							<key>Selector</key>
+							<string>setIsContainAnnotations:</string>
+							<key>ValueType</key>
+							<string>BOOL</string>
+							<key>Value</key>
+							<true/>
+						</dict>
+						<dict>
+							<key>Property</key>
+							<string>imageDpi</string>
+							<key>ValueType</key>
+							<string>int</string>
+							<key>Value</key>
+							<integer>216</integer>
+						</dict>
+					</array>
+				</dict>
 			</dict>
 		</dict>
 	</array>
@@ -345,8 +506,20 @@
 			<string>AutoTest</string>
 			<key>Params</key>
 			<dict>
-				<key>imageDpi</key>
-				<integer>216</integer>
+				<key>Options</key>
+				<dict>
+					<key>160</key>
+					<array>
+						<dict>
+							<key>Property</key>
+							<string>imageDpi</string>
+							<key>ValueType</key>
+							<string>int</string>
+							<key>Value</key>
+							<string>216</string>
+						</dict>
+					</array>
+				</dict>
 			</dict>
 		</dict>
 	</array>

+ 1 - 1
KdanAutoTest/KdanAuto/Class/CompareViewController/CompareViewController.swift

@@ -115,7 +115,7 @@ class CompareViewController: NSViewController, NSTableViewDataSource, NSTableVie
     func processNextImages(_ pdf:PDFDocument, index:Int32, files:NSMutableArray, url:URL, needFilter:Bool) -> Void {
         let file = files[Int(index)] as! NSMutableDictionary
         
-        NSLog("处理第\(index)页")
+//        NSLog("处理第\(index)页")
         
         // 所有文档均导出
         let cell = ImageCompareCellView.shared()

+ 21 - 4
KdanAutoTest/KdanAuto/Class/Setting/SettingViewController.swift

@@ -92,14 +92,31 @@ class SettingViewController : NSViewController, NSTextFieldDelegate, NSWindowDel
     
     @IBAction func sdkChangeAction(_ sender:NSButton) {
         let currentVersion = CPDFConvertKit.sharedInstance().versionNumber!
-        self.sdkChangeAlertLbl.isHidden = NSString(string: currentVersion).isEqual(to: self.sdkPopBtn.titleOfSelectedItem)
-        
         let path = NSString(string: Bundle.main.sharedFrameworksPath!).deletingLastPathComponent.appending("/Frameworks");
-        let originPath = path.appending("/ComPDFKit_Conversion.framework")
+        
+        
+        let originPath = NSString(string: path).appendingPathComponent("ComPDFKit_Conversion.framework")
         let nPath = NSString(string: path).appendingFormat("/ComPDFKit_Conversion_%@.framework", self.sdkPopBtn.titleOfSelectedItem!) as String
         
+        NSLog("[KdanAuto]originPath - \(originPath)");
+        NSLog("[KdanAuto]nPath - \(nPath)");
         try? FileManager.default.removeItem(atPath: originPath);
-        try? FileManager.default.copyItem(atPath: nPath, toPath: originPath)
+        do {
+            try? FileManager.default.copyItem(atPath: nPath, toPath: originPath)
+        }catch {
+            NSLog("[KdanAuto]拷贝出错");
+            
+            let shPath = Bundle.main.path(forResource: "UpdateSDK.sh", ofType: nil)!
+            
+            let process = Process()
+            process.launchPath = "/bin/sh";
+            process.arguments = [shPath, path, "ComPDFKit_Conversion", self.sdkPopBtn.titleOfSelectedItem!]
+            let pipe = Pipe()
+            process.launch()
+            process.waitUntilExit();
+        }
+        
+        self.sdkChangeAlertLbl.isHidden = NSString(string: currentVersion).isEqual(to: self.sdkPopBtn.titleOfSelectedItem)
     }
     
     // Show

+ 8 - 0
KdanAutoTest/KdanAuto/Class/Setting/UpdateSDK.sh

@@ -0,0 +1,8 @@
+Folder=$1
+FrameworkName=$2
+UpdateToVersion=$3
+MarkStr="_"
+
+cd $Folder
+rm -rf "$FrameworkName.framework"
+cp -rf "$FrameworkName$MarkStr$UpdateToVersion.framework" "$FrameworkName.framework"

+ 48 - 11
KdanAutoTest/KdanAuto/Class/Tools/FileConveter/FileConverter.swift

@@ -35,6 +35,8 @@ class FileConverter : NSObject, CPDFConverterDelegate, CPDFConverterFPDelegate {
     var accessSemaphore:DispatchSemaphore? = DispatchSemaphore.init(value: 1)
     var didSuccess:Int = 1
     
+    let m_currentVersion = CPDFConvertKit.sharedInstance().buildNumber
+    
     var complention = { (status:Int) in
         
     }
@@ -97,7 +99,7 @@ class FileConverter : NSObject, CPDFConverterDelegate, CPDFConverterFPDelegate {
             }
         }
         
-        NSLog("%@ - %@\n\(inSrcPath)", useOldLib ? "老库" : "新库", params ?? "")
+//        NSLog("%@ - %@\n\(inSrcPath)", useOldLib ? "老库" : "新库", params ?? "")
         
         self.convertQueue.async {
             let url = URL.init(fileURLWithPath: self.srcPath, isDirectory: false)
@@ -128,13 +130,7 @@ class FileConverter : NSObject, CPDFConverterDelegate, CPDFConverterFPDelegate {
                     }else {
                         (self.options as! CPDFConvertImgOptions).type = .PNG
                     }
-                    if (params != nil) {
-                        if let dipValue = params!["imageDpi"] as? NSNumber {
-                            if (CPDFConvertKit.sharedInstance().buildNumber > 150) {
-                                try? (self.options as! CPDFConvertImgOptions).imageDpi = Int32(dipValue.intValue)
-                            }
-                        }
-                    }
+                    self.configForOptions(self.options, inParams: tParams);
                     do {
                         try? self.pdfConverter?.convert(toFilePath: cachePath, pageIndexs: self.pages, options: self.options)
                     }catch {
@@ -151,6 +147,7 @@ class FileConverter : NSObject, CPDFConverterDelegate, CPDFConverterFPDelegate {
                     }
                     self.pdfConverter?.delegate = self
                     self.options = CPDFConvertPPTOptions()
+                    self.configForOptions(self.options, inParams: tParams);
                     self.pdfConverter?.convert(toFilePath: self.desPath,
                                                pageIndexs: self.pages, options: self.options)
                 }
@@ -162,6 +159,7 @@ class FileConverter : NSObject, CPDFConverterDelegate, CPDFConverterFPDelegate {
                     }
                     self.pdfConverter?.delegate = self
                     self.options = CPDFConvertWordOptions()
+                    self.configForOptions(self.options, inParams: tParams);
                     self.pdfConverter?.convert(toFilePath: self.desPath,
                                                pageIndexs: self.pages, options: self.options)
                 }
@@ -173,6 +171,7 @@ class FileConverter : NSObject, CPDFConverterDelegate, CPDFConverterFPDelegate {
                     }
                     self.pdfConverter?.delegate = self
                     self.options = CPDFConvertExcelOptions()
+                    self.configForOptions(self.options, inParams: tParams);
                     self.pdfConverter?.convert(toFilePath: self.desPath,
                                                pageIndexs: self.pages, options: self.options)
                 }
@@ -185,6 +184,7 @@ class FileConverter : NSObject, CPDFConverterDelegate, CPDFConverterFPDelegate {
                     }
                     self.pdfConverter?.delegate = self
                     self.options = CPDFConvertCsvOptions()
+                    self.configForOptions(self.options, inParams: tParams);
                     self.pdfConverter?.convert(toFilePath: cachePath,
                                                pageIndexs: self.pages, options: self.options)
                 }
@@ -197,9 +197,10 @@ class FileConverter : NSObject, CPDFConverterDelegate, CPDFConverterFPDelegate {
                     }
                     self.pdfConverter?.delegate = self
                     self.options = CPDFConvertHtmlOptions()
-                    if ((tParams.value(forKey: "paneOptions") as? NSNumber) != nil) {
-                        (self.options as! CPDFConvertHtmlOptions).paneOptions = CPDFConvertHtmlPageAndNavigationPaneOptions(rawValue: (tParams.value(forKey: "paneOptions") as! NSNumber).intValue)!
-                    }
+//                    if ((tParams.value(forKey: "paneOptions") as? NSNumber) != nil) {
+//                        (self.options as! CPDFConvertHtmlOptions).paneOptions = CPDFConvertHtmlPageAndNavigationPaneOptions(rawValue: (tParams.value(forKey: "paneOptions") as! NSNumber).intValue)!
+//                    }
+                    self.configForOptions(self.options, inParams: tParams);
                     self.pdfConverter?.convert(toFilePath: cachePath,
                                                pageIndexs: self.pages, options: self.options)
                 }
@@ -211,6 +212,7 @@ class FileConverter : NSObject, CPDFConverterDelegate, CPDFConverterFPDelegate {
                     }
                     self.pdfConverter?.delegate = self
                     self.options = CPDFConvertRtfOptions()
+                    self.configForOptions(self.options, inParams: tParams);
                     self.pdfConverter?.convert(toFilePath: self.desPath,
                                                pageIndexs: self.pages, options: self.options)
                 }
@@ -222,6 +224,7 @@ class FileConverter : NSObject, CPDFConverterDelegate, CPDFConverterFPDelegate {
                     }
                     self.pdfConverter?.delegate = self
                     self.options = CPDFConvertTxtOptions()
+                    self.configForOptions(self.options, inParams: tParams);
                     self.pdfConverter?.convert(toFilePath: self.desPath,
                                                pageIndexs: self.pages, options: self.options)
                 }
@@ -352,5 +355,39 @@ class FileConverter : NSObject, CPDFConverterDelegate, CPDFConverterFPDelegate {
             cancelTask();
         }
     }
+    
+    
+    // Config Options Tools
+    func configForOptions(_ inOptions:CPDFConvertOptions?, inParams:NSDictionary?) {
+        // Fetch Options Info
+        let versionInfo = NSDictionary(dictionary: (inParams?.value(forKey: "Options") as? [AnyHashable:Any]) ?? [:])
+        
+        // options is not empty or nil
+        if (versionInfo.allKeys.count > 0) {
+            var allVersions = versionInfo.allKeys
+            
+            // Sort versions (by release date)
+            allVersions = allVersions.sorted(by: { version1, version2 in
+                let value1 = NSString(string: version1 as! String).integerValue
+                let value2 = NSString(string: version2 as! String).integerValue
+                
+                return (value1 > value2);
+            });
+            
+            NSLog("\(allVersions)");
+            
+            for version in allVersions {
+                if (self.m_currentVersion >= NSString(string: version as! String).integerValue) {
+                    // config params for version
+                    let prams = versionInfo.value(forKey: version as! String) as! NSArray
+                    
+                    for param in prams {
+                        PerformSelectTool.performSelector(inOptions as Any, params: param as! [AnyHashable : Any]);
+                    }
+                }
+            }
+        }
+    }
+    
 }
 

+ 5 - 5
KdanAutoTest/KdanAuto/Class/Tools/ImageProcess/ImageProcess.swift

@@ -204,7 +204,7 @@ class ImageProcess : NSObject {
                 }
             }
             
-            NSLog(String("过滤点数目\(bgCount)"))
+//            NSLog(String("过滤点数目\(bgCount)"))
             
             return outDegree
         }
@@ -394,7 +394,7 @@ class ImageProcess : NSObject {
             
             DispatchQueue.global().async {
                 autoreleasepool {
-                    NSLog(String("过滤点数目\(bgCount)"))
+//                    NSLog(String("过滤点数目\(bgCount)"))
                     
                     complention(outDegree)
                 }
@@ -472,9 +472,9 @@ class ImageProcess : NSObject {
                 }
             }
             
-            if nil != bgColor {
-                NSLog(String("识别到背景色\(bgColor)"))
-            }
+//            if nil != bgColor {
+//                NSLog(String("识别到背景色\(bgColor)"))
+//            }
             
             // Compare
             let compareDifValue = DataModel.shared.comparativeDifference()

+ 18 - 0
KdanAutoTest/KdanAuto/Class/Tools/PerformSelectorTool/PerformSelectTool.h

@@ -0,0 +1,18 @@
+//
+//  PerformSelectTool.h
+//  KdanAuto
+//
+//  Created by 朱东勇 on 2023/4/7.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface PerformSelectTool : NSObject
+
++ (void)performSelector:(id)object params:(NSDictionary*)params;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 89 - 0
KdanAutoTest/KdanAuto/Class/Tools/PerformSelectorTool/PerformSelectTool.m

@@ -0,0 +1,89 @@
+//
+//  PerformSelectTool.m
+//  KdanAuto
+//
+//  Created by 朱东勇 on 2023/4/7.
+//
+
+#import "PerformSelectTool.h"
+
+@implementation PerformSelectTool
+
++ (void)performSelector:(id)object params:(NSDictionary*)params {
+    SEL selector = NULL;
+    if (params[@"Selector"]) {
+        selector = NSSelectorFromString(params[@"Selector"]);
+    }else if (params[@"Property"]) {
+        NSString *property = params[@"Property"];
+        property = [NSString stringWithFormat:@"set%@%@:",
+                    [property substringToIndex:1].uppercaseString,
+                    [property substringFromIndex:1]];
+        selector = NSSelectorFromString(property);
+    }else {
+        return;
+    }
+    
+    if (![object respondsToSelector:selector])
+        return;
+    
+    NSMethodSignature *signature = [object methodSignatureForSelector:selector];
+    NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
+    
+    NSString *valueType = params[@"ValueType"];
+    id value = params[@"Value"];
+    if (valueType && value) {
+        if ([valueType.lowercaseString isEqualToString:@"bool"]) {
+            BOOL v = [(NSNumber*)value boolValue];
+            [invocation setArgument:&v atIndex:2];
+        }else if ([valueType.lowercaseString isEqualToString:@"int"] ||
+                  [valueType isEqualToString:@"uint8_t"] ||
+                  [valueType isEqualToString:@"int8_t"] ||
+                  [valueType isEqualToString:@"NSInteger"] ||
+                  [valueType isEqualToString:@"NSUInteger"]) {
+            int v = [(NSNumber*)value intValue];
+            [invocation setArgument:&v atIndex:2];
+        }else if ([valueType.lowercaseString isEqualToString:@"float"]) {
+            float v = [(NSNumber*)value floatValue];
+            [invocation setArgument:&v atIndex:2];
+        }else if ([valueType.lowercaseString isEqualToString:@"double"]) {
+            float v = [(NSNumber*)value doubleValue];
+            [invocation setArgument:&v atIndex:2];
+        }else  {
+            [invocation setArgument:&value atIndex:2];
+        }
+    }
+    
+    NSString *valueType2 = params[@"ValueType2"];
+    id value2 = params[@"Value2"];
+    if (valueType2 && value2) {
+        if ([valueType2.lowercaseString isEqualToString:@"BOOL"]) {
+            BOOL v = [(NSNumber*)value2 boolValue];
+            [invocation setArgument:&v atIndex:3];
+        }else if ([valueType2.lowercaseString isEqualToString:@"int"] ||
+                  [valueType2 isEqualToString:@"uint8_t"] ||
+                  [valueType2 isEqualToString:@"int8_t"] ||
+                  [valueType2 isEqualToString:@"NSInteger"] ||
+                  [valueType2 isEqualToString:@"NSUInteger"]) {
+            int v = [(NSNumber*)value2 intValue];
+            [invocation setArgument:&v atIndex:3];
+        }else if ([valueType2.lowercaseString isEqualToString:@"float"]) {
+            float v = [(NSNumber*)value2 floatValue];
+            [invocation setArgument:&v atIndex:3];
+        }else if ([valueType2.lowercaseString isEqualToString:@"double"]) {
+            float v = [(NSNumber*)value2 doubleValue];
+            [invocation setArgument:&v atIndex:3];
+        }else  {
+            [invocation setArgument:&value2 atIndex:3];
+        }
+    }
+    
+    invocation.selector = selector;
+    invocation.target = object;
+    [invocation invoke];
+    
+#if DEBUG || 1
+    NSLog(@"[%@ %@%@]", object, NSStringFromSelector(selector), value);
+#endif
+}
+
+@end

+ 0 - 10
KdanAutoTest/KdanAuto/KdanAutoDebug.entitlements

@@ -2,16 +2,6 @@
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
-	<key>com.apple.security.cs.allow-dyld-environment-variables</key>
-	<true/>
-	<key>com.apple.security.cs.allow-jit</key>
-	<true/>
-	<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
-	<true/>
-	<key>com.apple.security.cs.debugger</key>
-	<true/>
-	<key>com.apple.security.cs.disable-executable-page-protection</key>
-	<true/>
 	<key>com.apple.security.cs.disable-library-validation</key>
 	<true/>
 </dict>

+ 1 - 0
KdanAutoTest/KdanAuto/KdanAuto_Bringe_Header.h

@@ -10,5 +10,6 @@
 
 #import "ZipArchive.h"
 #import <ComPDFKit_Conversion/CPDFConvertKit.h>
+#import "PerformSelectTool.h"
 
 #endif /* Header_h */

+ 54 - 0
KdanAutoTest/KdanAuto/ViewController.swift

@@ -308,6 +308,60 @@ class ViewController : NSViewController, SettingViewControllerDelegate, AutoTest
         }
     }
     
+    @IBAction func clearAllCheckFilesItem(_ sender:NSButton) {
+        DispatchQueue.global().async {
+            autoreleasepool {
+                for fileType in testFileTypes {
+                    let types = testTypeInfo[fileType] as! NSArray
+                    for typeInfo in types {
+                        let ti = typeInfo as! NSDictionary
+                        let type = ti["Type"] as! NSString
+                        
+                        let testObject = AutoTest.autoTestFor(fileType as NSString, type: type)
+                        if nil != testObject {
+                            testObject?.clearCompareFiles()
+                        }
+                    }
+                }
+                
+                DispatchQueue.main.async {
+                    autoreleasepool {
+                        self.reloadListData()
+                        
+                        self.advanceView.setAutoTestObj(self.advanceView._autoTestObj)
+                    }
+                }
+            }
+        }
+    }
+    
+    @IBAction func clearAllReportItem(_ sender:NSButton) {
+        DispatchQueue.global().async {
+            autoreleasepool {
+                for fileType in testFileTypes {
+                    let types = testTypeInfo[fileType] as! NSArray
+                    for typeInfo in types {
+                        let ti = typeInfo as! NSDictionary
+                        let type = ti["Type"] as! NSString
+                        
+                        let testObject = AutoTest.autoTestFor(fileType as NSString, type: type)
+                        if nil != testObject {
+                            testObject?.clearCacheFiles()
+                        }
+                    }
+                }
+                
+                DispatchQueue.main.async {
+                    autoreleasepool {
+                        self.reloadListData()
+                        
+                        self.advanceView.setAutoTestObj(self.advanceView._autoTestObj)
+                    }
+                }
+            }
+        }
+    }
+    
     @IBAction func diselectAllTestItem(_ sender:NSButton) {
         for fileType in testFileTypes {
             let types = testTypeInfo[fileType] as! NSArray