AutoTestProtocal.swift 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //
  2. // AutoTestProtocal.swift
  3. // KdanAuto
  4. //
  5. // Created by 朱东勇 on 2022/11/22.
  6. //
  7. import Foundation
  8. enum AutoTestStatus : Int {
  9. case Normal = 0
  10. case Wait = 1
  11. case Process = 2
  12. case Finished = 3
  13. }
  14. protocol AutoTestProtocal : NSObjectProtocol {
  15. // 类型关键字
  16. func fileType() -> String // PPT/RTF/EXCEL/Word/....
  17. func type() -> String
  18. func name() -> String
  19. func extention() -> String
  20. func params() -> NSDictionary
  21. func keys() -> NSArray
  22. func selectedKeys() -> NSArray
  23. func setSelectedKeys(_ keys:NSArray)
  24. // 是否勾选了快照测试
  25. func needCompareTest() -> Bool
  26. // func autoTest()
  27. func autoTest(_ complention:@escaping (_ object:AutoTest, _ report:NSAttributedString?) -> ())
  28. func testReport() -> NSAttributedString?
  29. // func testReportOfFile(_ fileName:String) -> NSAttributedString?
  30. /** Default is 0.0, The range of value is [0, 1]
  31. */
  32. func degree() -> Double
  33. func degreeOfFile(_ fileName:String) -> Double
  34. func degreeOfFile(_ fileName:String, refFilePath:String?) -> Double
  35. func compareFiles() -> NSArray?
  36. func compareFiles(_ fileName: String) -> NSArray?
  37. /**
  38. Replace the refrence image for next image check test
  39. */
  40. func canUpdateRefImage() -> Bool
  41. func updateRefImage()
  42. func canUpdateRefImage(_ fileName:String) -> Bool
  43. func updateRefImage(_ fileName:String)
  44. var testlog : (_ msg:String, _ progress:Double) -> () { get }
  45. func status() -> AutoTestStatus
  46. }