Forráskód Böngészése

Demo - 左侧列表滚动浏览时,有点慢(MacBook Air 11.6)
Demo - 转档报告中,相似度100%的可以不必标红色

zhudongyong 2 éve
szülő
commit
1659c4c94e

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

@@ -995,11 +995,13 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CODE_SIGN_ENTITLEMENTS = ProcessCheckFile/ProcessCheckFileDebug.entitlements;
-				CODE_SIGN_STYLE = Manual;
+				CODE_SIGN_IDENTITY = "Apple Development";
+				"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
+				CODE_SIGN_STYLE = Automatic;
 				COMBINE_HIDPI_IMAGES = YES;
 				CURRENT_PROJECT_VERSION = 1;
-				DEVELOPMENT_TEAM = "";
-				ENABLE_HARDENED_RUNTIME = YES;
+				DEVELOPMENT_TEAM = 4GGQPGRTSV;
+				ENABLE_HARDENED_RUNTIME = NO;
 				GENERATE_INFOPLIST_FILE = YES;
 				INFOPLIST_KEY_NSHumanReadableCopyright = "";
 				INFOPLIST_KEY_NSMainStoryboardFile = Main;

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


+ 1 - 1
KdanAutoTest/KdanAuto.xcodeproj/xcshareddata/xcschemes/KdanAuto.xcscheme

@@ -53,7 +53,7 @@
       </Testables>
    </TestAction>
    <LaunchAction
-      buildConfiguration = "Release"
+      buildConfiguration = "Debug"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       launchStyle = "0"

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

@@ -14,8 +14,8 @@
             filePath = "KdanAuto/Class/AutoTestCase/AutoTest.swift"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "558"
-            endingLineNumber = "558"
+            startingLineNumber = "562"
+            endingLineNumber = "562"
             landmarkName = "stringToImage(_:)"
             landmarkType = "7">
          </BreakpointContent>
@@ -46,10 +46,10 @@
             filePath = "KdanAuto/ViewController.swift"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "260"
-            endingLineNumber = "260"
-            landmarkName = "ViewController"
-            landmarkType = "3">
+            startingLineNumber = "269"
+            endingLineNumber = "269"
+            landmarkName = "tableView(_:shouldSelectRow:)"
+            landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
       <BreakpointProxy
@@ -126,8 +126,8 @@
             filePath = "KdanAuto/Class/FileConveter/FileConverter.swift"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "79"
-            endingLineNumber = "79"
+            startingLineNumber = "90"
+            endingLineNumber = "90"
             landmarkName = "converter(_:inDesPath:)"
             landmarkType = "7">
          </BreakpointContent>

+ 36 - 22
KdanAutoTest/KdanAuto/Base.lproj/Main.storyboard

@@ -688,7 +688,7 @@
                     <window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" titleVisibility="hidden" id="IQv-IB-iLA">
                         <windowStyleMask key="styleMask" titled="YES" miniaturizable="YES"/>
                         <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
-                        <rect key="contentRect" x="196" y="240" width="800" height="600"/>
+                        <rect key="contentRect" x="196" y="240" width="900" height="600"/>
                         <rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
                         <connections>
                             <outlet property="delegate" destination="B8D-0N-5wS" id="98r-iN-zZc"/>
@@ -707,16 +707,16 @@
             <objects>
                 <viewController id="XfG-lQ-9wD" customClass="ViewController" customModule="KdanAuto" customModuleProvider="target" sceneMemberID="viewController">
                     <view key="view" id="m2S-Jp-Qdl">
-                        <rect key="frame" x="0.0" y="0.0" width="800" height="600"/>
+                        <rect key="frame" x="0.0" y="0.0" width="900" height="600"/>
                         <autoresizingMask key="autoresizingMask"/>
                         <subviews>
                             <customView id="WFX-nZ-eg1">
-                                <rect key="frame" x="20" y="71" width="760" height="509"/>
-                                <autoresizingMask key="autoresizingMask"/>
+                                <rect key="frame" x="20" y="71" width="860" height="509"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                 <subviews>
                                     <customView id="Kjq-VU-WrU" customClass="AutoTestAdvanceSettingView" customModule="KdanAuto" customModuleProvider="target">
-                                        <rect key="frame" x="240" y="0.0" width="520" height="509"/>
-                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                        <rect key="frame" x="340" y="0.0" width="520" height="509"/>
+                                        <autoresizingMask key="autoresizingMask" flexibleMinX="YES" heightSizable="YES"/>
                                         <subviews>
                                             <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="97D-lF-aBw">
                                                 <rect key="frame" x="18" y="459" width="484" height="30"/>
@@ -750,19 +750,19 @@
                                                 </scroller>
                                             </scrollView>
                                             <scrollView borderType="none" horizontalLineScroll="24" horizontalPageScroll="10" verticalLineScroll="24" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" id="yne-Go-aGr">
-                                                <rect key="frame" x="10" y="9" width="501" height="321"/>
+                                                <rect key="frame" x="5" y="5" width="510" height="320"/>
                                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                 <clipView key="contentView" drawsBackground="NO" id="NxD-NS-AL6">
-                                                    <rect key="frame" x="0.0" y="0.0" width="501" height="321"/>
+                                                    <rect key="frame" x="0.0" y="0.0" width="510" height="320"/>
                                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                     <subviews>
                                                         <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" multipleSelection="NO" autosaveColumns="NO" rowHeight="24" rowSizeStyle="automatic" viewBased="YES" id="3yx-Nh-6Zg">
-                                                            <rect key="frame" x="0.0" y="0.0" width="501" height="321"/>
+                                                            <rect key="frame" x="0.0" y="0.0" width="510" height="320"/>
                                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                             <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
                                                             <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
                                                             <tableColumns>
-                                                                <tableColumn identifier="AutomaticTableColumnIdentifier.0" width="469" minWidth="40" maxWidth="1000" id="tho-Im-VMj">
+                                                                <tableColumn identifier="AutomaticTableColumnIdentifier.0" width="478" minWidth="40" maxWidth="1000" id="tho-Im-VMj">
                                                                     <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
                                                                         <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                                                         <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
@@ -775,11 +775,11 @@
                                                                     <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
                                                                     <prototypeCellViews>
                                                                         <tableCellView id="Tt2-uB-m3g">
-                                                                            <rect key="frame" x="10" y="0.0" width="481" height="24"/>
+                                                                            <rect key="frame" x="10" y="0.0" width="490" height="24"/>
                                                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                                             <subviews>
                                                                                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="MRV-3Y-yO9">
-                                                                                    <rect key="frame" x="0.0" y="4" width="481" height="16"/>
+                                                                                    <rect key="frame" x="0.0" y="4" width="490" height="16"/>
                                                                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
                                                                                     <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="rww-Rv-HvX">
                                                                                         <font key="font" usesAppearanceFont="YES"/>
@@ -823,8 +823,21 @@
                                                     <action selector="replaceAllAction:" target="Kjq-VU-WrU" id="1ij-PT-0Zf"/>
                                                 </connections>
                                             </button>
+                                            <button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Iqk-4J-ihy">
+                                                <rect key="frame" x="483" y="10" width="26" height="26"/>
+                                                <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
+                                                <buttonCell key="cell" type="round" title="+" bezelStyle="circular" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="u4G-aB-CJE">
+                                                    <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                    <font key="font" metaFont="system"/>
+                                                </buttonCell>
+                                                <color key="bezelColor" name="linkColor" catalog="System" colorSpace="catalog"/>
+                                                <connections>
+                                                    <action selector="addFileAction:" target="Kjq-VU-WrU" id="70i-oL-iF6"/>
+                                                </connections>
+                                            </button>
                                         </subviews>
                                         <connections>
+                                            <outlet property="_addBtn" destination="Iqk-4J-ihy" id="PQ0-MX-coI"/>
                                             <outlet property="_fileList" destination="3yx-Nh-6Zg" id="Fvu-8v-vPN"/>
                                             <outlet property="_keyContentView" destination="S9g-Wx-VNn" id="Ns7-LW-Z1T"/>
                                             <outlet property="_keyScrollView" destination="AmP-9q-6TA" id="ynY-Qs-1DP"/>
@@ -833,19 +846,19 @@
                                         </connections>
                                     </customView>
                                     <scrollView fixedFrame="YES" borderType="none" horizontalLineScroll="24" horizontalPageScroll="10" verticalLineScroll="24" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vbh-MI-nC2">
-                                        <rect key="frame" x="0.0" y="0.0" width="241" height="509"/>
-                                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" heightSizable="YES"/>
+                                        <rect key="frame" x="0.0" y="0.0" width="340" height="509"/>
+                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                         <clipView key="contentView" drawsBackground="NO" id="31q-iH-Dv4">
-                                            <rect key="frame" x="0.0" y="0.0" width="241" height="509"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="340" height="509"/>
                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                             <subviews>
                                                 <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" multipleSelection="NO" autosaveColumns="NO" rowHeight="24" rowSizeStyle="automatic" viewBased="YES" id="4NA-ss-yPX">
-                                                    <rect key="frame" x="0.0" y="0.0" width="241" height="509"/>
+                                                    <rect key="frame" x="0.0" y="0.0" width="340" height="509"/>
                                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                     <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
                                                     <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
                                                     <tableColumns>
-                                                        <tableColumn identifier="AutomaticTableColumnIdentifier.0" width="209" minWidth="40" maxWidth="1000" id="tTn-qb-QPH">
+                                                        <tableColumn identifier="AutomaticTableColumnIdentifier.0" width="308" minWidth="40" maxWidth="1000" id="tTn-qb-QPH">
                                                             <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
                                                                 <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                                                 <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
@@ -858,11 +871,11 @@
                                                             <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
                                                             <prototypeCellViews>
                                                                 <tableCellView id="61W-tC-cHP">
-                                                                    <rect key="frame" x="10" y="0.0" width="221" height="24"/>
+                                                                    <rect key="frame" x="10" y="0.0" width="320" height="24"/>
                                                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                                     <subviews>
                                                                         <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="qTx-Jq-OYX">
-                                                                            <rect key="frame" x="0.0" y="4" width="221" height="16"/>
+                                                                            <rect key="frame" x="0.0" y="4" width="320" height="16"/>
                                                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
                                                                             <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="tC6-ue-LUg">
                                                                                 <font key="font" usesAppearanceFont="YES"/>
@@ -898,7 +911,7 @@
                                 </subviews>
                             </customView>
                             <button verticalHuggingPriority="750" id="CUw-Wo-mUO">
-                                <rect key="frame" x="370" y="6" width="60" height="60"/>
+                                <rect key="frame" x="420" y="6" width="60" height="60"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                 <buttonCell key="cell" type="bevel" title="Start" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="aIx-Nb-X7k">
                                     <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -909,7 +922,7 @@
                                 </connections>
                             </button>
                             <button verticalHuggingPriority="750" id="Scu-90-mL7">
-                                <rect key="frame" x="710" y="2" width="77" height="32"/>
+                                <rect key="frame" x="810" y="2" width="77" height="32"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
                                 <buttonCell key="cell" type="push" title="More..." bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="8SI-7D-XJg">
                                     <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -920,7 +933,7 @@
                                 </connections>
                             </button>
                             <button toolTip="Replace refrence images for all file type" verticalHuggingPriority="750" id="NYu-z2-pHZ">
-                                <rect key="frame" x="611" y="2" width="101" height="32"/>
+                                <rect key="frame" x="711" y="2" width="101" height="32"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
                                 <buttonCell key="cell" type="push" title="Replace All" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="nOD-cy-PsK">
                                     <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -934,6 +947,7 @@
                     </view>
                     <connections>
                         <outlet property="advanceView" destination="Kjq-VU-WrU" id="ecC-8J-SWn"/>
+                        <outlet property="customView" destination="WFX-nZ-eg1" id="Qum-9S-ko1"/>
                         <outlet property="itemsList" destination="4NA-ss-yPX" id="uIe-KN-SjY"/>
                         <outlet property="replaceAllBtn" destination="NYu-z2-pHZ" id="ad4-9q-UWw"/>
                         <outlet property="startBtn" destination="CUw-Wo-mUO" id="mGh-eH-Fbj"/>

+ 7 - 3
KdanAutoTest/KdanAuto/Class/AutoTestCase/AutoTest.swift

@@ -82,7 +82,7 @@ class AutoTest : NSObject, AutoTestProtocal {
     }
     
     func keys() -> NSArray {
-        return ["快照对比"]
+        return ["快照"]
     }
     
     func selectedKeys() -> NSArray {
@@ -121,7 +121,7 @@ class AutoTest : NSObject, AutoTestProtocal {
         clearCacheFiles()
         
         if hasOriginFile() {
-            let needCompare = self.selectedKeys().contains("快照对比")
+            let needCompare = self.selectedKeys().contains("快照")
             
             if !needCompare {
                 _status = .Finished
@@ -201,8 +201,12 @@ class AutoTest : NSObject, AutoTestProtocal {
                                         self.reportString?.append(NSMutableAttributedString.init(string: "【\(String(self.fileType())) - \(self.name())】文件 \"\(subResultPath)\"快照对比失败,生成快照失败或无比对文件\n",
                                                                                             attributes:[.foregroundColor : NSColor.red]))
                                     }else {
+                                        var color = NSColor.black
+                                        if fabs(degree-100.0) >= 0.01 {
+                                            color = NSColor.red
+                                        }
                                         self.reportString?.append(NSMutableAttributedString.init(string: "【\(String(self.fileType())) - \(self.name())】文件 \"\(subResultPath)\"快照对比完成,图像相似度 \(degree)%\n",
-                                                                                            attributes:[.foregroundColor : NSColor.red]))
+                                                                                            attributes:[.foregroundColor : color]))
                                     }
                                 }else {
                                     self.reportString?.append(NSMutableAttributedString.init(string: "【\(String(self.fileType())) - \(self.name())】文件 \"\(subResultPath)\"快照生成失败\n",

+ 1 - 1
KdanAutoTest/KdanAuto/Class/AutoTestCase/FontAutoTest.swift

@@ -18,7 +18,7 @@ class FontAutoTest : AutoTest {
     }
     
     override func keys() -> NSArray {
-        return ["字体名称", "字体大小", "字体样式", "快照对比"]
+        return ["字体名称", "字体大小", "字体样式", "快照"]
     }
     
     override class func shared() -> AutoTest? {

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

@@ -19,7 +19,7 @@ class CharacterAutoTest : AutoTest {
     }
     
     override func keys() -> NSArray {
-        return ["字符对比", "快照对比"]
+        return ["字符", "快照"]
     }
     
     static var cSharedInstance = CharacterAutoTest()
@@ -32,8 +32,8 @@ class CharacterAutoTest : AutoTest {
     override func autoTest() {
         clearCacheFiles()
         
-        let checkString = self.selectedKeys().contains("字符对比")
-        let needCompare = self.selectedKeys().contains("快照对比")
+        let checkString = self.selectedKeys().contains("字符")
+        let needCompare = self.selectedKeys().contains("快照")
         
         if !needCompare && !checkString {
             _status = .Finished
@@ -212,8 +212,13 @@ class CharacterAutoTest : AutoTest {
                     
                     appendErrorInfo(skipString, failString: failString)
                     
-                    reportString?.append(NSAttributedString.init(string: "【\(String(self.fileType())) - \(self.name())】文件 \"\(fName)\"比对完成,准确率\(Float(successCount)/Float(maxSize) * 100)%(\(successCount)/\(maxSize))\n",
-                                                                 attributes:[.foregroundColor : NSColor.blue]))
+                    let degree = Float(successCount)/Float(maxSize) * 100
+                    var color = NSColor.black
+                    if fabs(degree-100.0) >= 0.01 {
+                        color = NSColor.red
+                    }
+                    reportString?.append(NSAttributedString.init(string: "【\(String(self.fileType())) - \(self.name())】文件 \"\(fName)\"比对完成,准确率\(degree)%(\(successCount)/\(maxSize))\n",
+                                                                 attributes:[.foregroundColor : color]))
                     
                 }
                 // compare screenshoot between result file with check file
@@ -238,8 +243,12 @@ class CharacterAutoTest : AutoTest {
                                 self.reportString?.append(NSMutableAttributedString.init(string: "【\(String(self.fileType())) - \(self.name())】文件 \"\(fName)\"快照对比失败,生成快照失败或无比对文件\n",
                                                                                          attributes:[.foregroundColor : NSColor.red]))
                             }else {
+                                var color = NSColor.black
+                                if fabs(degree-100.0) >= 0.01 {
+                                    color = NSColor.red
+                                }
                                 self.reportString?.append(NSMutableAttributedString.init(string: "【\(String(self.fileType())) - \(self.name())】文件 \"\(fName)\"快照对比完成,图像相似度 \(degree)%\n",
-                                                                                         attributes:[.foregroundColor : NSColor.red]))
+                                                                                         attributes:[.foregroundColor : color]))
                             }
                         }else {
                             self.reportString?.append(NSMutableAttributedString.init(string: "【\(String(self.fileType())) - \(self.name())】文件 \"\(fName)\"快照生成失败\n",

+ 7 - 3
KdanAutoTest/KdanAuto/Class/AutoTestCase/TextColorAutoTest.swift

@@ -19,7 +19,7 @@ class TextColorAutoTest : AutoTest {
     }
     
     override func keys() -> NSArray {
-        return ["RGB", "透明度", "快照对比"]
+        return ["RGB", "透明度", "快照"]
     }
     
     static var tcSharedInstance = TextColorAutoTest()
@@ -34,7 +34,7 @@ class TextColorAutoTest : AutoTest {
         
         let checkRGB = self.selectedKeys().contains("RGB")
         let checkAlpha = self.selectedKeys().contains("透明度")
-        let needCompare = self.selectedKeys().contains("快照对比")
+        let needCompare = self.selectedKeys().contains("快照")
         
         if !checkRGB && !checkAlpha && !needCompare {
             _status = .Finished
@@ -282,8 +282,12 @@ class TextColorAutoTest : AutoTest {
                                 self.reportString?.append(NSMutableAttributedString.init(string: "【\(String(self.fileType())) - \(self.name())】文件 \"\(fName)\"快照对比失败,生成快照失败或无比对文件\n",
                                                                                     attributes:[.foregroundColor : NSColor.red]))
                             }else {
+                                var color = NSColor.black
+                                if fabs(degree-100.0) >= 0.01 {
+                                    color = NSColor.red
+                                }
                                 self.reportString?.append(NSMutableAttributedString.init(string: "【\(String(self.fileType())) - \(self.name())】文件 \"\(fName)\"快照对比完成,图像相似度 \(degree)%\n",
-                                                                                    attributes:[.foregroundColor : NSColor.red]))
+                                                                                    attributes:[.foregroundColor : color]))
                             }
                         }else {
                             self.reportString?.append(NSMutableAttributedString.init(string: "【\(String(self.fileType())) - \(self.name())】文件 \"\(fName)\"快照生成失败\n",

+ 11 - 0
KdanAutoTest/KdanAuto/Class/FileConveter/FileConverter.swift

@@ -46,6 +46,17 @@ class FileConverter : NSObject, CPDFConverterDelegate, CPDFConverterFPDelegate {
         if !FileManager.default.fileExists(atPath: srcPath) {
             return false
         }
+        if FileManager.default.fileExists(atPath: desPath) {
+            try! FileManager.default.removeItem(atPath: desPath)
+        }
+        let attributy = try! FileManager.default.attributesOfItem(atPath: srcPath)
+        let fileType = attributy[FileAttributeKey.type] as! FileAttributeType
+        if NSString(string: FileAttributeType.typeSymbolicLink.rawValue).isEqual(to: fileType.rawValue) {
+            let symbolicLink = try? FileManager.default.destinationOfSymbolicLink(atPath: self.srcPath)
+            if nil != symbolicLink {
+                self.srcPath = symbolicLink!
+            }
+        }
          
         accessSemaphore?.wait()
         if FileManager.default.fileExists(atPath: self.desPath) {

+ 45 - 1
KdanAutoTest/KdanAuto/Class/Norrmal/AutoTestAdvanceSettingView.swift

@@ -24,6 +24,8 @@ class AutoTestAdvanceSettingView : NSView, NSTableViewDataSource, NSTableViewDel
     @IBOutlet var _fileList : NSTableView!
     @IBOutlet var _replaceAllBtn : NSButton!
     
+    @IBOutlet var _addBtn : NSButton!
+    
     var _keyViews : NSMutableArray!
     var _autoTestObj : AutoTest?
     
@@ -35,6 +37,8 @@ class AutoTestAdvanceSettingView : NSView, NSTableViewDataSource, NSTableViewDel
     override func awakeFromNib() {
         self.wantsLayer = true;
         self.layer?.backgroundColor = NSColor.windowBackgroundColor.cgColor
+        
+        _addBtn.isHidden = true;
     }
     
     
@@ -45,7 +49,9 @@ class AutoTestAdvanceSettingView : NSView, NSTableViewDataSource, NSTableViewDel
         
         // Set Title
 //        self.setAccessibilityEnabled((_autoTestObj?.isOriginFileExist() == true && _autoTestObj?.isCheckFileExist() == true))
-//        
+//
+        
+        _addBtn.isHidden = nil == _autoTestObj;
         if nil != _autoTestObj {
             _titleLbl.stringValue = String("[\(_autoTestObj?.fileType() as! String)]\(_autoTestObj?.name() as! String)")
             let checkKeys = _autoTestObj?.keys() as! NSArray
@@ -152,6 +158,44 @@ class AutoTestAdvanceSettingView : NSView, NSTableViewDataSource, NSTableViewDel
         }
     }
     
+    @IBAction func addFileAction(_ sender:NSButton) {
+        if nil == _autoTestObj {
+            return
+        }
+        
+        let originDirectory = _autoTestObj?.originFileDirectory()
+        
+        let openPanel = NSOpenPanel()
+        
+        openPanel.canChooseFiles = true
+        openPanel.allowedContentTypes = [.pdf]
+        openPanel.canChooseDirectories = false
+        
+        let comboBox = NSComboBox.init(frame: NSRect.init(x: 0, y: 0, width: 100, height: 25))
+        comboBox.removeAllItems()
+        comboBox.addItems(withObjectValues: ["添加超链接", "导入文件"])
+        comboBox.selectItem(at: 0)
+        openPanel.accessoryView = comboBox;
+        
+        if openPanel.runModal() == NSApplication.ModalResponse.OK {
+            let path = openPanel.url?.relativePath
+            
+            let resultPath = NSString(string: originDirectory!).appendingPathComponent(openPanel.url!.lastPathComponent)
+            
+            if FileManager.default.fileExists(atPath: path!) {
+                if comboBox.indexOfSelectedItem == 0 {
+                    try! FileManager.default.createSymbolicLink(atPath: resultPath, withDestinationPath: path!)
+                }else {
+                    try! FileManager.default.copyItem(atPath: path!, toPath: resultPath)
+                }
+                
+                _files = DataModel.shared.originFilesFor(String(_autoTestObj?.fileType() ?? ""),
+                                                         type: String(_autoTestObj?.type() ?? ""))
+                _fileList.reloadData()
+            }
+        }
+    }
+    
     
     // TableView Delegate
     func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {

+ 1 - 3
KdanAutoTest/KdanAuto/Class/Norrmal/Cell/TestCaseCellView.swift

@@ -10,7 +10,6 @@ import AppKit
 
 class TestCaseCellView : NSTableCellView {
     @IBOutlet var _titleLbl : NSTextField!
-    @IBOutlet var _keyScrollView : NSScrollView!
     @IBOutlet var _keyContentView : NSView!
     @IBOutlet var _sepLine : NSView!
     @IBOutlet var _activityView : ActivityView!
@@ -94,9 +93,8 @@ class TestCaseCellView : NSTableCellView {
             width = width + tfView.frame.size.width + 3
         }
 //        _keyContentView.frame = NSRect(x: 0, y: 0, width: width, height: kTFDefaultHeight)
-        _keyContentView.setFrameSize(NSSize.init(width: width, height: kTFDefaultHeight))
+//        _keyContentView.setFrameSize(NSSize.init(width: width, height: kTFDefaultHeight))
         
-        _keyScrollView.documentView = _keyContentView;
     }
     
     public func checkKeys() -> NSArray? {

+ 6 - 24
KdanAutoTest/KdanAuto/Class/Norrmal/Cell/TestCaseCellView.xib

@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
+        <deployment identifier="macosx"/>
         <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
@@ -25,28 +26,10 @@
                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                     </textFieldCell>
                 </textField>
-                <scrollView borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" verticalScrollElasticity="none" id="n2m-gK-mlz">
-                    <rect key="frame" x="9" y="6" width="320" height="32"/>
-                    <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
-                    <clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="VAh-KM-jZY">
-                        <rect key="frame" x="0.0" y="0.0" width="320" height="32"/>
-                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                        <subviews>
-                            <view id="RGK-vl-yJC">
-                                <rect key="frame" x="0.0" y="0.0" width="322" height="34"/>
-                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                            </view>
-                        </subviews>
-                    </clipView>
-                    <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="o4j-5g-APJ">
-                        <rect key="frame" x="-100" y="-100" width="320" height="16"/>
-                        <autoresizingMask key="autoresizingMask"/>
-                    </scroller>
-                    <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="Dh0-Lf-Lpe">
-                        <rect key="frame" x="-100" y="-100" width="16" height="32"/>
-                        <autoresizingMask key="autoresizingMask"/>
-                    </scroller>
-                </scrollView>
+                <view id="zMS-2A-6Cy">
+                    <rect key="frame" x="8" y="7" width="322" height="24"/>
+                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                </view>
                 <customView id="Dg0-nG-U3m">
                     <rect key="frame" x="9" y="0.0" width="325" height="1"/>
                     <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
@@ -54,8 +37,7 @@
             </subviews>
             <connections>
                 <outlet property="_activityView" destination="xZE-kG-hKQ" id="QaP-h4-ll6"/>
-                <outlet property="_keyContentView" destination="RGK-vl-yJC" id="qmx-mV-sDv"/>
-                <outlet property="_keyScrollView" destination="n2m-gK-mlz" id="vpO-R3-c7L"/>
+                <outlet property="_keyContentView" destination="zMS-2A-6Cy" id="Egq-9y-jXs"/>
                 <outlet property="_sepLine" destination="Dg0-nG-U3m" id="fck-m4-6W4"/>
                 <outlet property="_titleLbl" destination="EgA-BQ-X23" id="Kft-ve-pVP"/>
                 <outlet property="textField" destination="EgA-BQ-X23" id="j2n-kB-6EY"/>

+ 1 - 1
KdanAutoTest/KdanAuto/Class/Norrmal/Cell/TestFileCellView.xib

@@ -26,7 +26,7 @@
                     <rect key="frame" x="0.0" y="0.0" width="331" height="1"/>
                     <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
                 </customView>
-                <button verticalHuggingPriority="750" fixedFrame="YES" id="1iY-9V-oMo">
+                <button verticalHuggingPriority="750" id="1iY-9V-oMo">
                     <rect key="frame" x="265" y="-2" width="77" height="32"/>
                     <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
                     <buttonCell key="cell" type="push" title="Replace" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="fG4-an-Nhx">

+ 9 - 0
KdanAutoTest/KdanAuto/ViewController.swift

@@ -9,6 +9,7 @@ import Cocoa
 
 class ViewController : NSViewController, SettingViewControllerDelegate, AutoTestAdvanceSettingViewDelegate,
                        NSTableViewDelegate, NSTableViewDataSource {
+    @IBOutlet var customView : NSView!
     
     @IBOutlet var settingVCWindow : NSWindow!
     @IBOutlet var settingVC : SettingViewController!
@@ -26,6 +27,14 @@ class ViewController : NSViewController, SettingViewControllerDelegate, AutoTest
     override func viewDidLoad() {
         super.viewDidLoad()
 
+        customView.wantsLayer = true;
+        customView.layer?.borderColor = NSColor.lightGray.withAlphaComponent(0.4).cgColor
+        customView.layer?.borderWidth = 1
+        
+        advanceView.wantsLayer = true
+        advanceView.layer?.borderColor = NSColor.lightGray.withAlphaComponent(0.4).cgColor
+        advanceView.layer?.borderWidth = 1
+        
         // Load Infos
         let path = Bundle.main.path(forResource: "AutoTestProperty", ofType: "plist")!
         let url = URL.init(fileURLWithPath: path, isDirectory: false)

+ 20 - 5
KdanAutoTest/ProcessCheckFile/ViewController.swift

@@ -12,12 +12,27 @@ class ViewController: NSViewController {
     override func viewDidLoad() {
         super.viewDidLoad()
         
-//        ProcessFont.processRTFAutoFile(.FontNameWithSize)
-//        ProcessFont.processRTFAutoFile(.Color)
-//        ProcessFont.processRTFAutoFile(.SpecialCharacter)
-//        ProcessFont.processRTFAutoFile(.Chinese)
+        //        ProcessFont.processRTFAutoFile(.FontNameWithSize)
+        //        ProcessFont.processRTFAutoFile(.Color)
+        //        ProcessFont.processRTFAutoFile(.SpecialCharacter)
+        //        ProcessFont.processRTFAutoFile(.Chinese)
         
-//        ProcessThumbnal.process("/Users/zhudongyong/Desktop/文档/对照文档/PDFConvert_China_Auto_Test.rtf")
+        //        ProcessThumbnal.process("/Users/zhudongyong/Desktop/文档/对照文档/PDFConvert_China_Auto_Test.rtf")
+        FileAttributeKey.busy
+        let fileAttributy = try! FileManager.default.attributesOfItem(atPath: "/Users/zhudongyong/Desktop/文档 2/BMP/Others/Origin Files/125-years-of-topo-mapping.pdf")
+        let symbAttributy = try! FileManager.default.attributesOfItem(atPath: "/Users/zhudongyong/Desktop/文档 2/BMP/Others/Origin Files/125-years-of-topo-mapping的替身.pdf")
+        let fileAttributy2 = try! FileManager.default.attributesOfItem(atPath: "/Users/zhudongyong/Desktop/文档 2/BMP/Others/Origin Files/nrcs141p2_018306.pdf")
+        let symbAttributy2 = try! FileManager.default.attributesOfItem(atPath: "/Users/zhudongyong/Desktop/文档 2/BMP/Others/Origin Files/nrcs141p2_018306的替身.pdf")
+        
+        let url = URL.init(filePath: "/Users/zhudongyong/Desktop/文档 2/BMP/Others/Origin Files/125-years-of-topo-mapping的替身.pdf")
+        let string = try! NSDictionary.init(contentsOf: url, error: ())
+        
+        NSLog("%@", fileAttributy)
+        NSLog("%@", symbAttributy)
+        NSLog("%@", fileAttributy2)
+        NSLog("%@", symbAttributy2)
+        
+        NSLog("%@", string)
     }
 
     override var representedObject: Any? {