def test_logPrint_bold(): savedStdout = sys.stdout try: out = StringIO() sys.stdout = out imageEdit.logPrint("test", "bold") output = out.getvalue().strip() assert output == "\033[01mtest\033[00m" finally: sys.stdout = savedStdout
def test_logPrint_info(): savedStdout = sys.stdout try: out = StringIO() sys.stdout = out imageEdit.logPrint("test", "info") output = out.getvalue().strip() assert output == "[\033[96m* Info\033[00m] test" finally: sys.stdout = savedStdout
def test_logPrint_error(): savedStdout = sys.stdout try: out = StringIO() sys.stdout = out imageEdit.logPrint("test", "error") output = out.getvalue().strip() assert output == "[\033[91m- Error\033[00m] test" finally: sys.stdout = savedStdout
def test_logPrint_warning(): savedStdout = sys.stdout try: out = StringIO() sys.stdout = out imageEdit.logPrint("test", "warning") output = out.getvalue().strip() assert output == "[\033[93m/ Warning\033[00m] test" finally: sys.stdout = savedStdout
def test_logPrint_success(): savedStdout = sys.stdout try: out = StringIO() sys.stdout = out imageEdit.logPrint("test", "success") output = out.getvalue().strip() assert output == "[\033[92m+ Success\033[00m] test" finally: sys.stdout = savedStdout
def test_logPrint_standard(): savedStdout = sys.stdout try: out = StringIO() sys.stdout = out imageEdit.logPrint("test", "standard") output = out.getvalue().strip() assert output == "test" finally: sys.stdout = savedStdout
import os, sys from pathlib import Path THISDIR = str(Path(__file__).resolve().parent) sys.path.insert(0, os.path.dirname(THISDIR) + "/lib") import imageEdit if __name__ == "__main__": # pragma: no cover # Image in should be 512px images = imageEdit.openImagesInDir(THISDIR + "/input/*", "logo") for imageRef in images: fileName, squareImage = imageRef fileNameParts = fileName.split(os.sep) fileName = fileNameParts[len(fileNameParts)-1] imageEdit.logPrint(fileName, "bold") outputDir = THISDIR + "/output/" + fileName + "/proj-icon" # Proj-icon does not want to be a mask if (imageEdit.getImageDesc(squareImage) == "mask"): textName = fileName.split('.')[0] imageEdit.saveImage(outputDir + "/name.png", imageEdit.addDropShadowSimple( imageEdit.roundCornersAntiAlias( imageEdit.resizeImageSquare( imageEdit.addText(squareImage, textName), "0.5x"), 64), [-10, 10]) )