-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate a correct memory layout and accessors for fields containing …
…a `GList`/`GSList` (fixes #173)
- Loading branch information
Showing
6 changed files
with
56 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
modules/gtk/src/test/java/io/github/jwharm/javagi/test/gtk/PangoLayoutLineTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package io.github.jwharm.javagi.test.gtk; | ||
|
||
import org.gnome.glib.SList; | ||
import org.gnome.gtk.Gtk; | ||
import org.gnome.gtk.Label; | ||
import org.gnome.pango.Context; | ||
import org.gnome.pango.Layout; | ||
import org.gnome.pango.LayoutLine; | ||
import org.gnome.pango.LayoutRun; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
/** | ||
* Test reading an {@link SList} from a field. | ||
*/ | ||
public class PangoLayoutLineTest { | ||
|
||
@Test | ||
public void testPangoLayoutLine() { | ||
Gtk.init(); | ||
|
||
String TEST_STR = "test"; | ||
int TEST_LENGTH = TEST_STR.length(); | ||
|
||
Label label = new Label(); | ||
Context context = label.getPangoContext(); | ||
Layout layout = new Layout(context); | ||
layout.setText(TEST_STR, TEST_LENGTH); | ||
SList<LayoutLine> lines = layout.getLinesReadonly(); | ||
LayoutLine line = lines.getFirst(); | ||
SList<LayoutRun> runs = line.readRuns(); | ||
LayoutRun run = runs.getFirst(); | ||
assertEquals(TEST_LENGTH, run.readItem().readNumChars()); | ||
} | ||
} |