3 Commity f485ca8202 ... 42529c1c63

Autor SHA1 Wiadomość Data
  zhudongyong 42529c1c63 综合 - 详情界面,显示对照文件、显示结果文件 无法显示问题修复; 1 rok temu
  zhudongyong bd3a9b3fd4 字符对比 - 字符串对比移除对(回车、换行符)的对比,但测试报告会显示 回车和换行的内容,以保证测试报告的排版; 1 rok temu
  zhudongyong eee41d905f 综合 - 测试项,修改测试类型,类型需要重启才能切换问题修复; 1 rok temu

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


+ 32 - 0
KdanAutoTest/KdanAuto.xcodeproj/xcuserdata/zhudongyong.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -180,5 +180,37 @@
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "7C3E1DCE-3161-4FA0-A0D3-E3CF0A2BC17A"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "KdanAuto/Class/AutoTestCase/StringAutoTest.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "160"
+            endingLineNumber = "160"
+            landmarkName = "autoTest(_:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "CD09136A-8DA8-4715-8DC1-B1E16639E535"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "KdanAuto/Class/AutoTestCase/StringAutoTest.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "174"
+            endingLineNumber = "174"
+            landmarkName = "autoTest(_:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
 </Bucket>

+ 53 - 8
KdanAutoTest/KdanAuto/Class/AutoTestCase/AutoTest.swift

@@ -1031,23 +1031,68 @@ extension AutoTest {
         return object
     }
     
-    func update(_ property:NSDictionary) {
+    func update(_ property:NSDictionary) -> AutoTest? {
+        let cClass = property["Class"] as! NSString
+        let oClass = self.m_info["Class"] as! NSString
+        
         let cID = property["ID"] as! NSString
         let cType = property["Type"] as! NSString
         let cExtention = property["Extention"] as! NSString
         let cName = property["Name"] as! NSString
         let cParams = property["Params"] as? NSDictionary
         
-        self.m_id = cID as String
-        self.m_info = NSDictionary(dictionary: property)
-        self._type = String(cType)
-        self._extention = String(cExtention)
-        self._name = String(cName)
-        if nil != cParams {
-            self._params = cParams ?? [:];
+        var object = self;
+        if (cClass.isEqual(to: oClass)) {
+            self.m_id = cID as String
+            self.m_info = NSDictionary(dictionary: property)
+            self._type = String(cType)
+            self._extention = String(cExtention)
+            self._name = String(cName)
+            if nil != cParams {
+                self._params = cParams ?? [:];
+            }
+        }else {
+            let fileType = self.fileType() as String
+            let key = self.fileType() as String
+            let ID = cID
+            
+            // 移除原来的Object
+            if cacheObjects.value(forKey: key) != nil {
+                let objectInfo = cacheObjects.value(forKey: key) as! NSMutableDictionary
+                
+                if objectInfo.value(forKey: ID as String) != nil {
+                    objectInfo.setValue(nil, forKey: ID as String)
+                }
+            }
+            
+            var objectInfo = cacheObjects.value(forKey: key) as? NSMutableDictionary
+            if (nil == objectInfo) {
+                objectInfo = NSMutableDictionary()
+                cacheObjects.setValue(objectInfo, forKey: key)
+            }
+            
+            let params = NSMutableDictionary(dictionary: property)
+            let clsname = "KdanAuto"//Bundle.main.infoDictionary! ["CFBundleExecutable"]
+            let className = String((clsname )+"."+(params["Class"] as! String))
+            let cl = NSClassFromString(className) as! AutoTest.Type
+            
+            object = cl.shared()!
+            object.m_id = ID as String
+            object.m_info = NSDictionary(dictionary: params)
+            object._fileType = fileType
+            object._type = String(cType)
+            object._extention = String(cExtention)
+            object._name = String(cName)
+            if nil != cParams {
+                object._params = cParams ?? [:];
+            }
+            objectInfo!.setValue(object, forKey: ID as String)
+            
         }
         
         AutoTest.saveObjects()
+        
+        return object
     }
     
     func delete() {

+ 9 - 1
KdanAutoTest/KdanAuto/Class/AutoTestCase/StringAutoBackTest.swift

@@ -190,8 +190,12 @@ class StringAutoBackTest : StringAutoTest {
         return autoreleasepool {
             var checkString = check
             var resultStr = result
-            let maxSize = checkString.length
+            var maxSize = checkString.length
             var successCount = 0;
+            
+            resultStr = resultStr.replacingOccurrences(of: "\n", with: "") as NSString
+            resultStr = resultStr.replacingOccurrences(of: " ", with: "") as NSString
+            
             /**
              (A0 = B0)
              - A-1 & B-1
@@ -227,6 +231,10 @@ class StringAutoBackTest : StringAutoTest {
                     resultStr = resultStr.substring(from:1) as NSString
                     successCount = successCount + 1
                     callback(NSAttributedString(string: subc as String))
+                }else if (["\n", "\r", " "].contains(subc)) {
+                    callback(NSAttributedString(string: subc as String))
+                    maxSize -= 1;
+                    checkString = checkString.substring(from:1) as NSString
                 } else if (cRange.location != NSNotFound &&
                            rRange.location != NSNotFound) {
                     if (min(cRange.location, rRange.location) >= 2) {

+ 14 - 6
KdanAutoTest/KdanAuto/Class/AutoTestCase/StringAutoTest.swift

@@ -270,8 +270,12 @@ class StringAutoTest : AutoTest {
         return autoreleasepool {
             var checkString = check
             var resultStr = result
-            let maxSize = checkString.length
+            var maxSize = checkString.length
             var successCount = 0;
+            
+            resultStr = resultStr.replacingOccurrences(of: "\n", with: "") as NSString
+            resultStr = resultStr.replacingOccurrences(of: " ", with: "") as NSString
+            
             /**
              (A0 = B0)
              - A-1 & B-1
@@ -307,7 +311,11 @@ class StringAutoTest : AutoTest {
                     resultStr = resultStr.substring(from:1) as NSString
                     successCount = successCount + 1
                     callback(NSAttributedString(string: subc as String))
-                } else if (cRange.location != NSNotFound &&
+                }else if (["\n", "\r", " "].contains(subc)) {
+                    callback(NSAttributedString(string: subc as String))
+                    maxSize -= 1;
+                    checkString = checkString.substring(from:1) as NSString
+                }else if (cRange.location != NSNotFound &&
                            rRange.location != NSNotFound) {
                     if (min(cRange.location, rRange.location) >= 2) {
                         let nextc = checkString.substring(with: NSRange(location: 1, length: 1)) as NSString
@@ -317,11 +325,11 @@ class StringAutoTest : AutoTest {
                         
                         if (min(nrRange.location, ncRange.location) < min(cRange.location, rRange.location)) {
                             if (ncRange.location < nrRange.location) {
-                                //‘subc' 字符串有在‘resultStr’中,但'subr'不在’checkString‘中,resultStr 往后推一
+                                //‘subc' 字符串有在‘resultStr’中,但'subr'不在’checkString‘中,resultStr 往后推一
                                 skipString = skipString.appending(subc as String) as NSString
                                 checkString = checkString.substring(from:1) as NSString
                             }else {
-                                //‘subc' 字符串有在‘resultStr’中,但'subr'不在’checkString‘中,resultStr 往后推一
+                                //‘subc' 字符串有在‘resultStr’中,但'subr'不在’checkString‘中,resultStr 往后推一
                                 failString = failString.appending(subr as String) as NSString
                                 resultStr = resultStr.substring(from:1) as NSString
                             }
@@ -423,8 +431,8 @@ class StringAutoTest : AutoTest {
             var documentAttributes:NSDictionary!
             let checkAttString = NSAttributedString.init(rtf: checkData, documentAttributes: &documentAttributes)
             var checkString = NSString(string: checkAttString!.string) as NSString
-            checkString = checkString.replacingOccurrences(of: "\n", with: "") as NSString
-            checkString = checkString.replacingOccurrences(of: " ", with: "") as NSString
+//            checkString = checkString.replacingOccurrences(of: "\n", with: "") as NSString
+//            checkString = checkString.replacingOccurrences(of: " ", with: "") as NSString
             // 常规 rtf 读取失败
             
             //使用框排进行读取

+ 16 - 2
KdanAutoTest/KdanAuto/Class/Norrmal/AutoTestAdvanceSettingView.swift

@@ -432,15 +432,29 @@ class AutoTestAdvanceSettingView : NSView, NSTableViewDataSource, NSTableViewDel
     }
     
     func fileCellNeedShowInFinder(_ cell:TestFileCellView, fileName:String, type:TestFileType) {
+        var nFileName = NSString(string: fileName)
+        
         var directory = _autoTestObj?.originFileDirectory()
         if (type == .Result) {
+            nFileName = NSString(string: nFileName.deletingPathExtension).appendingPathExtension(_autoTestObj?.extention() ?? "")! as NSString
             directory = _autoTestObj?.resultFileDirectory()
         }else if (type == .Compare) {
+            nFileName = NSString(string: nFileName.deletingPathExtension).appendingPathExtension(_autoTestObj?.extention() ?? "")! as NSString
             directory = _autoTestObj?.checkFileDirectory()
         }
         
-        var path = NSString(string: directory!).appendingPathComponent(fileName);
-        NSWorkspace.shared.activateFileViewerSelecting([URL(fileURLWithPath: path)])
+        var path = NSString(string: directory!).appendingPathComponent(nFileName as String);
+        if (FileManager.default.fileExists(atPath: path)) {
+            NSWorkspace.shared.activateFileViewerSelecting([URL(fileURLWithPath: path)])
+        }else {
+            path = NSString(string: path).deletingPathExtension.appending(".jpg")
+            
+            if (FileManager.default.fileExists(atPath: path)) {
+                NSWorkspace.shared.activateFileViewerSelecting([URL(fileURLWithPath: path)])
+            }else {
+                NSWorkspace.shared.activateFileViewerSelecting([URL(fileURLWithPath: NSString(string: path).deletingLastPathComponent)])
+            }
+        }
     }
     
     func fileCellNeedDelete(_ cell:TestFileCellView, fileName:String) {