|
@@ -121,6 +121,7 @@ class AutoTest : NSObject, AutoTestProtocal {
|
|
|
clearCacheFiles()
|
|
|
|
|
|
if hasOriginFile() {
|
|
|
+ NSLog(String("转换\(self.type())"))
|
|
|
let needCompare = self.selectedKeys().contains("快照")
|
|
|
|
|
|
if !needCompare {
|
|
@@ -163,7 +164,7 @@ class AutoTest : NSObject, AutoTestProtocal {
|
|
|
let searchItems = try! FileManager.default.contentsOfDirectory(atPath: resultPath)
|
|
|
for item in NSArray(array: searchItems) {
|
|
|
let ext = NSString(string: item as! String).pathExtension.lowercased()
|
|
|
- if NSArray(array: [_extention]).contains(ext) {
|
|
|
+ if (NSArray(array: [_extention]).contains(ext)) {
|
|
|
let fileName = NSString(string: fName+"."+_extention+"/\(item as! String)").deletingPathExtension
|
|
|
items.add(fileName)
|
|
|
}
|
|
@@ -202,10 +203,11 @@ class AutoTest : NSObject, AutoTestProtocal {
|
|
|
let pathCompotent = "/"+subImageName
|
|
|
let degree = ImageProcess.compareJPEG(String(rComparePath+pathCompotent), checkPath: String(cComparePath+pathCompotent), processCover: true)
|
|
|
|
|
|
- if isDirectory.boolValue {
|
|
|
- TestDegreeManager.shared().set(degree, fileType: self.fileType(), type: self.type(),
|
|
|
- fileName: fileName, refFilePath: subFileName+".jpg"+pathCompotent)
|
|
|
- }
|
|
|
+
|
|
|
+ NSLog(String("文件夹\(subFileName+".jpg"+pathCompotent)"))
|
|
|
+
|
|
|
+ TestDegreeManager.shared().set(degree, fileType: self.fileType(), type: self.type(),
|
|
|
+ fileName: fileName, refFilePath: subFileName+".jpg"+pathCompotent)
|
|
|
|
|
|
if degree == -1 {
|
|
|
self.reportString?.append(NSMutableAttributedString.init(string: "【\(String(self.fileType())) - \(self.name())】文件 \"\(subResultPath+pathCompotent)\"快照对比失败,生成快照失败或无比对文件\n",
|
|
@@ -227,10 +229,10 @@ class AutoTest : NSObject, AutoTestProtocal {
|
|
|
|
|
|
let degree = ImageProcess.compareJPEG(rComparePath, checkPath: cComparePath, processCover: true)
|
|
|
|
|
|
- if isDirectory.boolValue {
|
|
|
- TestDegreeManager.shared().set(degree, fileType: self.fileType(), type: self.type(),
|
|
|
- fileName: fileName, refFilePath: subFileName+".jpg")
|
|
|
- }
|
|
|
+ NSLog(String("非文件夹\(subFileName+".jpg")"))
|
|
|
+
|
|
|
+ TestDegreeManager.shared().set(degree, fileType: self.fileType(), type: self.type(),
|
|
|
+ fileName: fileName, refFilePath: subFileName+".jpg")
|
|
|
|
|
|
if degree == -1 {
|
|
|
self.reportString?.append(NSMutableAttributedString.init(string: "【\(String(self.fileType())) - \(self.name())】文件 \"\(subResultPath)\"快照对比失败,生成快照失败或无比对文件\n",
|
|
@@ -296,6 +298,19 @@ class AutoTest : NSObject, AutoTestProtocal {
|
|
|
convertQueue.async {
|
|
|
success = FileConverter.shared().converter(originPath, inDesPath: resultPath)
|
|
|
|
|
|
+ // 修复转 PNG 实际图片为 JPG 问题, 导致无法匹配问题
|
|
|
+ if (NSArray(array: ["png", "PNG"]).contains(NSString(string: resultPath).pathExtension)) {
|
|
|
+ let items = FileManager.default.subpaths(atPath: resultPath)! as [String]
|
|
|
+ for item in items {
|
|
|
+ if NSArray(array: ["jpg", "JPG"]).contains(NSString(string:item).pathExtension) {
|
|
|
+ let path = NSString(string: resultPath).appendingPathComponent(item);
|
|
|
+
|
|
|
+ try? FileManager.default.moveItem(atPath: path,
|
|
|
+ toPath: NSString(string: path).deletingPathExtension+".png");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
convertSemaphore.signal()
|
|
|
}
|
|
|
convertSemaphore.wait()
|
|
@@ -542,7 +557,7 @@ class AutoTest : NSObject, AutoTestProtocal {
|
|
|
let cComparePath = NSString(string: checkDirectory).appendingPathComponent(subFileName+".jpg")
|
|
|
|
|
|
let fileInfo = NSMutableDictionary.fileInfoWith(fileName,
|
|
|
- refFilePath: (isDirectory.boolValue ? (subFileName+".jpg") : nil),
|
|
|
+ refFilePath: subFileName+".jpg",
|
|
|
resultPath: rComparePath,
|
|
|
comparePath: cComparePath,
|
|
|
objc: self)
|