Browse Source

Add a check for screenshot name duplication.

pull/3705/head
Benoit Marty 2 weeks ago
parent
commit
aa8132227f
  1. 31
      tools/test/generateAllScreenshots.py

31
tools/test/generateAllScreenshots.py

@ -10,6 +10,7 @@ import os @@ -10,6 +10,7 @@ import os
import re
import sys
import time
from util import compare
@ -100,6 +101,34 @@ def computeDarkFileName(lightFileName): @@ -100,6 +101,34 @@ def computeDarkFileName(lightFileName):
return match.group(1) + "_Night_" + match.group(2) + "_" + match.group(3)
return ""
def checkForScreenshotNameDuplication():
__doc__ = "Check for screenshots name duplication"
print("Check for screenshots name duplication...")
files = os.listdir("tests/uitests/src/test/snapshots/images/")
dict = {}
for file in files:
start = file.find("_") + 1
end = file.find("_", start)
screenshotName = file[start:end]
if screenshotName in dict:
dict[screenshotName].append(file[:end])
else:
dict[screenshotName] = [file[:end]]
error = 0
for key in dict:
if key in ["Icon", "RoundIcon"]:
continue
values = set(dict[key])
if len(values) > 1:
print("Duplicated screenshot name: %s" % key)
for value in values:
print(" - %s" % value)
error += 1
if error:
print("Warning: %d duplicated screenshot name(s) found" % error)
def generateJavascriptFile():
__doc__ = "Generate a javascript file to load the screenshots"
print("Generating javascript file...")
@ -151,6 +180,7 @@ def generateJavascriptFile(): @@ -151,6 +180,7 @@ def generateJavascriptFile():
def main():
checkForScreenshotNameDuplication()
generateAllScreenshots(readArguments())
lang = detectLanguages()
for l in lang:
@ -158,4 +188,5 @@ def main(): @@ -158,4 +188,5 @@ def main():
moveScreenshots(l)
generateJavascriptFile()
main()

Loading…
Cancel
Save