Skip to content

Commit

Permalink
Add Ubuntu test container and split tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bailuk committed Feb 15, 2024
1 parent abf0bc6 commit 707db00
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 5 deletions.
25 changes: 25 additions & 0 deletions ci/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# A Ubuntu based build image
#
# This should be as identical as possible with the official GitHub Actions Ubuntu image
# https://github.com/actions/runner-images
#
# Based on https://hub.docker.com/_/ubuntu/

# podman build -f Dockerfile -t build-on-ubuntu
# podman run -it --name build-on-ubuntu build-on-ubuntu:latest
# => ./clone-and-build.sh

FROM docker.io/ubuntu:latest
LABEL version="0.1.0"

ENV JAVA_TOOL_OPTIONS "-Dfile.encoding=UTF8"

COPY clone-and-build.sh clone-and-build.sh
RUN chmod +x clone-and-build.sh

RUN apt-get -y update
RUN apt-get -y upgrade
RUN apt-get -y install git
RUN apt-get -y install openjdk-11-jdk-headless
RUN apt-get -y install libgtk-4-1
RUN apt-get -y clean
9 changes: 9 additions & 0 deletions ci/ubuntu/clone-and-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

test -d java-gtk || git clone "https://github.com/bailuk/java-gtk.git" || exit 1

cd java-gtk || exit 1
git pull || exit 1

./gradlew generate || exit 1
./gradlew build
2 changes: 0 additions & 2 deletions java-gtk/src/main/java/ch/bailu/gtk/type/PropertyHolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ public Str getStrProperty(String name) {
return value.getString();
}



public Pointer getObjectProperty(String name) {
var value = initValue(Object.getTypeID());
getProperty(name, value);
Expand Down
11 changes: 8 additions & 3 deletions java-gtk/src/test/java/ch/bailu/gtk/TestPropertyAccess.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ public static boolean gtkInit() {
}

public static boolean checkVersion() {
return Glib.checkVersion(2, 44,0).isNull();
return Glib.checkVersion(2, 74, 0).isNull();
}

@Test
@EnabledIf("checkVersion")
public void testPropertyAccess() {

public void testPropertyAccessListStore() {
var listStore = new ListStore(TextTag.getTypeID());
var textTag = new TextTag("test");

Expand All @@ -44,6 +43,12 @@ public void testPropertyAccess() {
var textTagGet = new TextTag(listStore.asListModel().getItem(0).cast());
assertEquals("test", textTagGet.getStringProperty("name"));
assertEquals("test", textTag.getStringProperty("name"));
}

@Test
public void testPropertyAccessTextTag() {
var textTag = new TextTag("test");
assertEquals("test", textTag.getStringProperty("name"));

textTag.setBooleanProperty("accumulative-margin", false);
assertFalse(textTag.getBooleanProperty("accumulative-margin"));
Expand Down

0 comments on commit 707db00

Please sign in to comment.