Преглед на файлове

转档 - 参数支持向后兼容;

zhudongyong преди 1 година
родител
ревизия
3ad1c22573

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


+ 6 - 8
KdanAutoTest/KdanAuto/Class/AutoTestCase/AutoTestProperty.plist

@@ -73,7 +73,7 @@
 							<key>Property</key>
 							<string>language</string>
 							<key>ValueType</key>
-							<string>int</string>
+							<string>NSInteger</string>
 							<key>Value</key>
 							<integer>0</integer>
 						</dict>
@@ -263,7 +263,7 @@
 							<key>Property</key>
 							<string>paneOptions</string>
 							<key>ValueType</key>
-							<string>int</string>
+							<string>NSInteger</string>
 							<key>Value</key>
 							<integer>0</integer>
 						</dict>
@@ -290,7 +290,7 @@
 							<key>Property</key>
 							<string>paneOptions</string>
 							<key>ValueType</key>
-							<string>int</string>
+							<string>NSInteger</string>
 							<key>Value</key>
 							<integer>2</integer>
 						</dict>
@@ -344,8 +344,6 @@
 						<dict>
 							<key>Property</key>
 							<string>isAllowOCR</string>
-							<key>Selector</key>
-							<string>setIsAllowOCR:</string>
 							<key>ValueType</key>
 							<string>BOOL</string>
 							<key>Value</key>
@@ -355,7 +353,7 @@
 							<key>Property</key>
 							<string>language</string>
 							<key>ValueType</key>
-							<string>int</string>
+							<string>NSInteger</string>
 							<key>Value</key>
 							<integer>0</integer>
 						</dict>
@@ -441,8 +439,8 @@
 					<key>160</key>
 					<array>
 						<dict>
-							<key>Selector</key>
-							<string>setIsContainAnnotations:</string>
+							<key>Property</key>
+							<string>isContainAnnotations</string>
 							<key>ValueType</key>
 							<string>BOOL</string>
 							<key>Value</key>

+ 8 - 3
KdanAutoTest/KdanAuto/Class/Norrmal/AutoTestAdvanceSettingView.swift

@@ -431,10 +431,15 @@ class AutoTestAdvanceSettingView : NSView, NSTableViewDataSource, NSTableViewDel
         }
     }
     
-    func fileCellNeedShowInFinder(_ cell:TestFileCellView, fileName:String) {
-        let originDirectory = _autoTestObj?.originFileDirectory()
-        let path = NSString(string: originDirectory!).appendingPathComponent(fileName);
+    func fileCellNeedShowInFinder(_ cell:TestFileCellView, fileName:String, type:TestFileType) {
+        var directory = _autoTestObj?.originFileDirectory()
+        if (type == .Result) {
+            directory = _autoTestObj?.resultFileDirectory()
+        }else if (type == .Compare) {
+            directory = _autoTestObj?.checkFileDirectory()
+        }
         
+        var path = NSString(string: directory!).appendingPathComponent(fileName);
         NSWorkspace.shared.activateFileViewerSelecting([URL(fileURLWithPath: path)])
     }
     

+ 44 - 8
KdanAutoTest/KdanAuto/Class/Norrmal/Cell/TestFileCellView.swift

@@ -8,12 +8,18 @@
 import Foundation
 import AppKit
 
+enum TestFileType {
+    case Origin
+    case Result
+    case Compare
+}
+
 protocol TestFileCellViewDelegate : NSObjectProtocol {
     func fileCellNeedReplace(_ cell:TestFileCellView, fileName:String)
     
     func fileCellNeedShowReport(_ cell:TestFileCellView, fileName:String, sender:NSButton)
     
-    func fileCellNeedShowInFinder(_ cell:TestFileCellView, fileName:String)
+    func fileCellNeedShowInFinder(_ cell:TestFileCellView, fileName:String, type:TestFileType)
     
     func fileCellNeedDelete(_ cell:TestFileCellView, fileName:String)
     
@@ -31,7 +37,14 @@ class TestFileCellView : NSTableCellView, NSMenuDelegate {
     var _title : String!
     var _isExpad: Bool!
     var _typeInfo : NSDictionary!
+    
+    
+    var _showOriginMenuItem : NSMenuItem!
+    var _showResultMenuItem : NSMenuItem!
+    var _showCompareMenuItem : NSMenuItem!
+    
     var _cancelMenuItem : NSMenuItem!
+    
     var _isActivting : Bool = false;
     
     var _degree : Double = 0
@@ -57,16 +70,32 @@ class TestFileCellView : NSTableCellView, NSMenuDelegate {
         _sepLine.layer?.backgroundColor = NSColor.lightGray.cgColor
         
         let _menu = NSMenu(title: "")
-        let item = NSMenuItem.init(title: "在访达中显示", action:#selector(self.showInFinder(_:)), keyEquivalent: "")
-        item.target = self;
-        _menu.addItem(item)
-        let item1 = NSMenuItem.init(title: "删除", action: #selector(self.deleteActions(_:)), keyEquivalent: "")
-        _menu.addItem(item1)
-        item1.target = self;
+        // Show In Finder
+        _showOriginMenuItem = NSMenuItem.init(title: "在访达中显示[原文件]", action:#selector(self.showInFinder(_:)), keyEquivalent: "")
+        _showOriginMenuItem.target = self;
+        _menu.addItem(_showOriginMenuItem)
+        _showResultMenuItem = NSMenuItem.init(title: "在访达中显示[结果文件]", action:#selector(self.showInFinder(_:)), keyEquivalent: "")
+        _showResultMenuItem.target = self;
+        _menu.addItem(_showResultMenuItem)
+        _showCompareMenuItem = NSMenuItem.init(title: "在访达中显示[对照文件]", action:#selector(self.showInFinder(_:)), keyEquivalent: "")
+        _showCompareMenuItem.target = self;
+        _menu.addItem(_showCompareMenuItem)
+        
+        _menu.addItem(NSMenuItem.separator());
+        
+        // Cancel Convert Task
         _cancelMenuItem = NSMenuItem.init(title: "取消转档任务", action: #selector(self.cancelAction(_:)), keyEquivalent: "")
         _cancelMenuItem.isEnabled = false;
         _menu.addItem(_cancelMenuItem)
         _cancelMenuItem.target = self;
+        
+        _menu.addItem(NSMenuItem.separator());
+        
+        // Delete Origin Files
+        let item1 = NSMenuItem.init(title: "删除", action: #selector(self.deleteActions(_:)), keyEquivalent: "")
+        _menu.addItem(item1)
+        item1.target = self;
+        
         self.menu = _menu
         self.menu?.delegate = self;
         
@@ -162,7 +191,14 @@ class TestFileCellView : NSTableCellView, NSMenuDelegate {
     
     @IBAction func showInFinder(_ sender:NSMenuItem) {
         if _delegate != nil {
-            _delegate?.fileCellNeedShowInFinder(self, fileName: _title)
+            var type = TestFileType.Origin;
+            if (sender == _showResultMenuItem) {
+                type = TestFileType.Result
+            }else if (sender == _showCompareMenuItem) {
+                type = TestFileType.Compare
+            }
+            
+            _delegate?.fileCellNeedShowInFinder(self, fileName: _title, type: type)
         }
     }
     

+ 1 - 3
KdanAutoTest/KdanAuto/Class/Tools/FileConveter/FileConverter.swift

@@ -371,11 +371,9 @@ class FileConverter : NSObject, CPDFConverterDelegate, CPDFConverterFPDelegate {
                 let value1 = NSString(string: version1 as! String).integerValue
                 let value2 = NSString(string: version2 as! String).integerValue
                 
-                return (value1 > value2);
+                return (value1 < value2);
             });
             
-            NSLog("\(allVersions)");
-            
             for version in allVersions {
                 if (self.m_currentVersion >= NSString(string: version as! String).integerValue) {
                     // config params for version

+ 101 - 20
KdanAutoTest/KdanAuto/Class/Tools/PerformSelectorTool/PerformSelectTool.m

@@ -6,6 +6,8 @@
 //
 
 #import "PerformSelectTool.h"
+#import <ComPDFKit_Conversion/ComPDFKit_Conversion.h>
+#import <AppKit/AppKit.h>
 
 @implementation PerformSelectTool
 
@@ -32,46 +34,129 @@
     NSString *valueType = params[@"ValueType"];
     id value = params[@"Value"];
     if (valueType && value) {
-        if ([valueType.lowercaseString isEqualToString:@"bool"]) {
+        if ([valueType isEqualToString:@"bool"] || [valueType 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"]) {
+        }else if ([valueType isEqualToString:@"int"]) {
             int v = [(NSNumber*)value intValue];
             [invocation setArgument:&v atIndex:2];
-        }else if ([valueType.lowercaseString isEqualToString:@"float"]) {
+        }else if ([valueType isEqualToString:@"size_t"]) {
+            size_t v = [(NSNumber*)value intValue];
+            [invocation setArgument:&v atIndex:2];
+        }else if ([valueType isEqualToString:@"uint8_t"]) {
+            uint8_t v = [(NSNumber*)value intValue];
+            [invocation setArgument:&v atIndex:2];
+        }else if ([valueType isEqualToString:@"int8_t"]) {
+            int8_t v = [(NSNumber*)value intValue];
+            [invocation setArgument:&v atIndex:2];
+        }else if ([valueType isEqualToString:@"int16_t"]) {
+            int16_t v = [(NSNumber*)value intValue];
+            [invocation setArgument:&v atIndex:2];
+        }else if ([valueType isEqualToString:@"uint16_t"]) {
+            uint16_t v = [(NSNumber*)value intValue];
+            [invocation setArgument:&v atIndex:2];
+        }else if ([valueType isEqualToString:@"int32_t"]) {
+            int32_t v = [(NSNumber*)value intValue];
+            [invocation setArgument:&v atIndex:2];
+        }else if ([valueType isEqualToString:@"uint32_t"]) {
+            uint32_t v = [(NSNumber*)value intValue];
+            [invocation setArgument:&v atIndex:2];
+        }else if ([valueType isEqualToString:@"int64_t"]) {
+            int64_t v = [(NSNumber*)value intValue];
+            [invocation setArgument:&v atIndex:2];
+        }else if ([valueType isEqualToString:@"uint64_t"]) {
+            uint64_t v = [(NSNumber*)value intValue];
+            [invocation setArgument:&v atIndex:2];
+        }else if ([valueType isEqualToString:@"NSInteger"]) {
+            NSInteger v = [(NSNumber*)value intValue];
+            [invocation setArgument:&v atIndex:2];
+        }else if ([valueType isEqualToString:@"NSUInteger"]) {
+            NSUInteger v = [(NSNumber*)value intValue];
+            [invocation setArgument:&v atIndex:2];
+        }else if ([valueType isEqualToString:@"float"]) {
             float v = [(NSNumber*)value floatValue];
             [invocation setArgument:&v atIndex:2];
-        }else if ([valueType.lowercaseString isEqualToString:@"double"]) {
+        }else if ([valueType isEqualToString:@"double"]) {
             float v = [(NSNumber*)value doubleValue];
             [invocation setArgument:&v atIndex:2];
+        }else if ([valueType isEqualToString:@"CGSize"]) {
+            CGSize v = NSSizeFromString(value);
+            [invocation setArgument:&v atIndex:2];
+        }else if ([valueType isEqualToString:@"CGRect"]) {
+            CGRect v = NSRectFromString(value);
+            [invocation setArgument:&v atIndex:2];
+        }else if ([valueType isEqualToString:@"NSSize"]) {
+            NSSize v = NSSizeFromString(value);
+            [invocation setArgument:&v atIndex:2];
+        }else if ([valueType isEqualToString:@"NSRect"]) {
+            NSRect v = NSRectFromString(value);
+            [invocation setArgument:&v atIndex:2];
         }else  {
             [invocation setArgument:&value atIndex:2];
         }
     }
+    NSTextField *tf;
     
     NSString *valueType2 = params[@"ValueType2"];
     id value2 = params[@"Value2"];
     if (valueType2 && value2) {
-        if ([valueType2.lowercaseString isEqualToString:@"BOOL"]) {
+        if ([valueType2 isEqualToString:@"BOOL"] || [valueType2 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"]) {
+        }else if ([valueType2 isEqualToString:@"int"]) {
             int v = [(NSNumber*)value2 intValue];
             [invocation setArgument:&v atIndex:3];
-        }else if ([valueType2.lowercaseString isEqualToString:@"float"]) {
+        }else if ([valueType2 isEqualToString:@"size_t"]) {
+            size_t v = [(NSNumber*)value2 intValue];
+            [invocation setArgument:&v atIndex:3];
+        }else if ([valueType2 isEqualToString:@"uint8_t"]) {
+            uint8_t v = [(NSNumber*)value2 intValue];
+            [invocation setArgument:&v atIndex:3];
+        }else if ([valueType2 isEqualToString:@"int8_t"]) {
+            int8_t v = [(NSNumber*)value2 intValue];
+            [invocation setArgument:&v atIndex:3];
+        }else if ([valueType2 isEqualToString:@"int16_t"]) {
+            int16_t v = [(NSNumber*)value2 intValue];
+            [invocation setArgument:&v atIndex:3];
+        }else if ([valueType2 isEqualToString:@"uint16_t"]) {
+            uint16_t v = [(NSNumber*)value2 intValue];
+            [invocation setArgument:&v atIndex:3];
+        }else if ([valueType2 isEqualToString:@"int32_t"]) {
+            int32_t v = [(NSNumber*)value2 intValue];
+            [invocation setArgument:&v atIndex:3];
+        }else if ([valueType2 isEqualToString:@"uint32_t"]) {
+            uint32_t v = [(NSNumber*)value2 intValue];
+            [invocation setArgument:&v atIndex:3];
+        }else if ([valueType2 isEqualToString:@"int64_t"]) {
+            int64_t v = [(NSNumber*)value2 intValue];
+            [invocation setArgument:&v atIndex:3];
+        }else if ([valueType2 isEqualToString:@"uint64_t"]) {
+            uint64_t v = [(NSNumber*)value2 intValue];
+            [invocation setArgument:&v atIndex:3];
+        }else if ([valueType2 isEqualToString:@"NSInteger"]) {
+            NSInteger v = [(NSNumber*)value2 intValue];
+            [invocation setArgument:&v atIndex:3];
+        }else if ([valueType2 isEqualToString:@"NSUInteger"]) {
+            NSUInteger v = [(NSNumber*)value2 intValue];
+            [invocation setArgument:&v atIndex:3];
+        }else if ([valueType2 isEqualToString:@"float"]) {
             float v = [(NSNumber*)value2 floatValue];
             [invocation setArgument:&v atIndex:3];
-        }else if ([valueType2.lowercaseString isEqualToString:@"double"]) {
+        }else if ([valueType2 isEqualToString:@"double"]) {
             float v = [(NSNumber*)value2 doubleValue];
             [invocation setArgument:&v atIndex:3];
+        }else if ([valueType2 isEqualToString:@"CGSize"]) {
+            CGSize v = NSSizeFromString(value2);
+            [invocation setArgument:&v atIndex:3];
+        }else if ([valueType2 isEqualToString:@"CGRect"]) {
+            CGRect v = NSRectFromString(value2);
+            [invocation setArgument:&v atIndex:3];
+        }else if ([valueType2 isEqualToString:@"NSSize"]) {
+            NSSize v = NSSizeFromString(value2);
+            [invocation setArgument:&v atIndex:3];
+        }else if ([valueType2 isEqualToString:@"NSRect"]) {
+            NSRect v = NSRectFromString(value2);
+            [invocation setArgument:&v atIndex:3];
         }else  {
             [invocation setArgument:&value2 atIndex:3];
         }
@@ -80,10 +165,6 @@
     invocation.selector = selector;
     invocation.target = object;
     [invocation invoke];
-    
-#if DEBUG || 1
-    NSLog(@"[%@ %@%@]", object, NSStringFromSelector(selector), value);
-#endif
 }
 
 @end