ソースを参照

主界面 - 自动化测试列表 UI 部分

zhudongyong 2 年 前
コミット
988b95e7f7

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


+ 2 - 2
KdanAutoTest/KdanAuto.xcodeproj/xcuserdata/zhudongyong.xcuserdatad/xcschemes/xcschememanagement.plist

@@ -7,12 +7,12 @@
 		<key>KdanAuto.xcscheme_^#shared#^_</key>
 		<dict>
 			<key>orderHint</key>
-			<integer>1</integer>
+			<integer>0</integer>
 		</dict>
 		<key>ProcessCheckFile.xcscheme_^#shared#^_</key>
 		<dict>
 			<key>orderHint</key>
-			<integer>0</integer>
+			<integer>1</integer>
 		</dict>
 	</dict>
 </dict>

+ 50 - 0
KdanAutoTest/KdanAuto/Class/Norrmal/TestCaseCellView.swift

@@ -11,6 +11,10 @@ import AppKit
 class TestCaseCellView : NSTableCellView {
     @IBOutlet var _titleLbl : NSTextField!
     @IBOutlet var _keyScrollView : NSScrollView!
+    @IBOutlet var _keyContentView : NSView!
+    @IBOutlet var _sepLine : NSView!
+    
+    var _keyViews : NSMutableArray!
     
     var _title : String!
     var _checkKeys : NSArray!
@@ -29,6 +33,11 @@ class TestCaseCellView : NSTableCellView {
         return nil
     }
     
+    override func awakeFromNib() {
+        _sepLine.wantsLayer = true;
+        _sepLine.layer?.backgroundColor = NSColor.lightGray.cgColor
+    }
+    
     // Setter & Getter
     public func setTitle(_ title:String) {
         _title = title;
@@ -40,10 +49,51 @@ class TestCaseCellView : NSTableCellView {
         return _title
     }
     
+    let kTFDefaultHeight = 22.0
     public func setCheckKeys(_ keys:NSArray) {
+        
         _checkKeys = keys;
         
+        if _keyViews == nil {
+            _keyViews = NSMutableArray()
+        }
+        while (_keyViews.count != _checkKeys.count) {
+            if (_keyViews.count > _checkKeys.count) {
+                (_keyViews.lastObject as! NSTextField).removeFromSuperview()
+                _keyViews.removeLastObject()
+            }else {
+                let tf = NSTextField.init(frame: CGRectMake(0, 4, 30, kTFDefaultHeight));
+                _keyContentView.addSubview(tf);
+                tf.backgroundColor = .clear
+                _keyViews.add(tf)
+            }
+        }
+        
+        var width = 0.0;
+        
+        for tf in _keyViews {
+            let i = _keyViews.index(of: tf)
+            let tfView = tf as! NSTextField
+            
+            tfView.stringValue = _checkKeys[i] as! String;
+            
+            tfView.sizeToFit()
+            
+            tfView.setFrameOrigin(NSPoint.init(x: width, y: 0))
+            tfView.setFrameSize(NSSize.init(width: (tfView.frame.size.width.advanced(by: 2.0)), height: kTFDefaultHeight));
+            tfView.autoresizingMask = .maxXMargin.union(.maxYMargin)
+            tfView.wantsLayer = true
+            tfView.layer?.cornerRadius = 8
+            tfView.layer?.backgroundColor = NSColor.clear.cgColor
+            tfView.layer?.borderColor = NSColor.lightGray.withAlphaComponent(0.6).cgColor
+            tfView.layer?.borderWidth = 1
+            
+            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))
         
+        _keyScrollView.documentView = _keyContentView;
     }
     
     public func checkKeys() -> NSArray? {

+ 16 - 10
KdanAutoTest/KdanAuto/Class/Norrmal/TestCaseCellView.xib

@@ -21,31 +21,37 @@
                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                     </textFieldCell>
                 </textField>
-                <scrollView fixedFrame="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="n2m-gK-mlz">
-                    <rect key="frame" x="10" y="6" width="319" height="32"/>
+                <scrollView borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" 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" id="VAh-KM-jZY">
-                        <rect key="frame" x="1" y="1" width="317" height="30"/>
+                    <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="302" height="15"/>
-                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <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" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="o4j-5g-APJ">
-                        <rect key="frame" x="1" y="15" width="317" height="16"/>
+                    <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" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="Dh0-Lf-Lpe">
-                        <rect key="frame" x="302" y="1" width="16" height="30"/>
+                    <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>
+                <customView fixedFrame="YES" id="Dg0-nG-U3m">
+                    <rect key="frame" x="9" y="0.0" width="320" height="1"/>
+                    <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
+                </customView>
             </subviews>
             <connections>
+                <outlet property="_keyContentView" destination="RGK-vl-yJC" id="qmx-mV-sDv"/>
                 <outlet property="_keyScrollView" destination="n2m-gK-mlz" id="vpO-R3-c7L"/>
+                <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"/>
             </connections>

+ 1 - 0
KdanAutoTest/KdanAuto/ViewController.swift

@@ -51,6 +51,7 @@ NSTableViewDelegate, NSTableViewDataSource {
         let cellView = TestCaseCellView.shared()
         
         cellView?.setTitle(testCaseNames[row])
+        cellView?.setCheckKeys(["Color", "Font Size", "Font Name", "Font Style"])
         
         return cellView
     }