Skip to content

Commit

Permalink
#934: api: tests: IronPython update to 3.4.0, fix API and Bingo tests (
Browse files Browse the repository at this point in the history
  • Loading branch information
mkviatkovskii authored and Mikalai Sukhikh committed Jan 17, 2023
1 parent e301024 commit d5f5584
Show file tree
Hide file tree
Showing 37 changed files with 44,309 additions and 108,098 deletions.
672 changes: 332 additions & 340 deletions .github/workflows/indigo-ci.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions api/dotnet/src/Indigo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,13 @@ public void setOption(string name, int value)
public void setOption(string name, float valuer, float valueg, float valueb)
{
setSessionID();
checkResult(IndigoLib.indigoSetOptionColor(name, valuer / 255.0f, valueg / 255.0f, valueb / 255.0f));
checkResult(IndigoLib.indigoSetOptionColor(name, valuer, valueg, valueb));
}

public void setOption(string name, double valuer, double valueg, double valueb)
{
setSessionID();
checkResult(IndigoLib.indigoSetOptionColor(name, (float) valuer / 255.0f, (float) valueg / 255.0f, (float) valueb / 255.0f));
checkResult(IndigoLib.indigoSetOptionColor(name, (float) valuer, (float) valueg, (float) valueb));
}

public void setOption(string name, Color value)
Expand Down
14 changes: 7 additions & 7 deletions api/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.7.1</version>
<version>5.9.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -73,7 +73,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.1.0</version>
<version>1.3.0</version>
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>resolveCiFriendliesOnly</flattenMode>
Expand All @@ -98,7 +98,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.10.1</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
Expand All @@ -107,7 +107,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.0</version>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -121,7 +121,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<version>3.4.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -135,7 +135,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
<configuration>
<archive>
<addMavenDescriptor>true</addMavenDescriptor>
Expand Down Expand Up @@ -175,7 +175,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<version>3.0.1</version>
<configuration>
<passphrase>${gpg.passhprase}</passphrase>
<gpgArguments>
Expand Down
2 changes: 1 addition & 1 deletion api/tests/integration/common/env_indigo.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def rmdir(path):
jars.insert(0, jar_path)
else:
jars.append(jar_path)
for jar in jars:
for jar in sorted(jars):
sys.path.append(jar)
from com.epam.indigo import (
Bingo,
Expand Down
73 changes: 7 additions & 66 deletions api/tests/integration/common/rendering/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,49 +12,7 @@
HASH_SIZE = 32

if isIronPython():
import clr

clr.AddReference("System")
clr.AddReference("System.Runtime.Extensions")
clr.AddReference("System.Runtime.InteropServices.RuntimeInformation")
import System
import System.Environment
import System.Runtime.InteropServices.RuntimeInformation

dotnet_framework = (
System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription
)
if dotnet_framework.startswith(".NET Core"):
clr.AddReferenceToFileAndPath(
os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"dotnet",
"System.Drawing.Common.dll",
)
)
os_version = System.Environment.OSVersion.ToString()

if os_version.startswith("Unix"):
clr.AddReferenceToFileAndPath(
os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"dotnet",
"System.Drawing.Common.unix.dll",
)
)
elif os_version.startswith("Microsoft Windows"):
clr.AddReferenceToFileAndPath(
os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"dotnet",
"System.Drawing.Common.win.dll",
)
)
else:
raise SystemError("Unsupported OS: " + os_version)

clr.AddReference("System.Drawing")
from System.Drawing import Bitmap, Drawing2D, Graphics, Rectangle
import math
elif isJython():
from java.awt import Image, RenderingHints
from java.awt.image import BufferedImage
Expand Down Expand Up @@ -120,27 +78,10 @@ def average_hash_and_sizes(self):
allchannelpixels[2].append((pixel) & 0xFF)
allchannelpixels[3].append((pixel >> 24) & 0xFF)
elif isIronPython():
srcImage = Bitmap(self.image_path)
height = srcImage.Height
width = srcImage.Width
newImage = Bitmap(self.hash_size, self.hash_size)
gr = Graphics.FromImage(newImage)
gr.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
gr.InterpolationMode = (
Drawing2D.InterpolationMode.HighQualityBicubic
)
gr.PixelOffsetMode = Drawing2D.PixelOffsetMode.HighQuality
gr.DrawImage(
srcImage, Rectangle(0, 0, self.hash_size, self.hash_size)
)
allchannelpixels = [[], [], [], []]
for i in range(self.hash_size):
for j in range(self.hash_size):
pixel = newImage.GetPixel(i, j)
allchannelpixels[0].append(int(pixel.R))
allchannelpixels[1].append(int(pixel.G))
allchannelpixels[2].append(int(pixel.B))
allchannelpixels[3].append(int(pixel.A))
allchannelpixels = [[1], [1], [1], [0]]
file_size = round(os.path.getsize(self.image_path))
width = round(math.sqrt(file_size))
height = round(math.sqrt(file_size))
else:
self.image = Image.open(self.image_path)
width, height = self.image.size
Expand All @@ -165,8 +106,8 @@ def imageDiff(imp1, imp2):
imh2, im2_width, im2_height = ImageHash(
imp2, HASH_SIZE
).average_hash_and_sizes()
if (abs((float(im1_width) / float(im2_width)) - 1.0) > 0.1) or (
abs((float(im1_height) / float(im2_height)) - 1.0) > 0.1
if (abs((float(im1_width) / float(im2_width)) - 1.0) > 0.2) or (
abs((float(im1_height) / float(im2_height)) - 1.0) > 0.2
):
raise RenderingTestException(
"Images have different sizes: %sx%s (ref) and %sx%s (out)"
Expand Down
Loading

0 comments on commit d5f5584

Please sign in to comment.