-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix warning in ListIndexModel and add testcase
- Loading branch information
Showing
2 changed files
with
33 additions
and
1 deletion.
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
28 changes: 28 additions & 0 deletions
28
modules/gio/src/test/java/io/github/jwharm/javagi/test/gio/ListModelTest.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,28 @@ | ||
package io.github.jwharm.javagi.test.gio; | ||
|
||
import io.github.jwharm.javagi.gio.ListIndexModel; | ||
import org.gnome.gio.Gio; | ||
import org.gnome.gio.ListModel; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
/** | ||
* Test some operations on ListIndexModel | ||
*/ | ||
public class ListModelTest { | ||
|
||
@Test | ||
public void createListModel() { | ||
// explicitly trigger initialization | ||
Gio.javagi$ensureInitialized(); | ||
|
||
ListModel listIndexModel = ListIndexModel.newInstance(1000); | ||
assertEquals(listIndexModel.getItemType(), ListIndexModel.ListIndex.getType()); | ||
assertEquals(1000, listIndexModel.getNItems()); | ||
|
||
var item500 = (ListIndexModel.ListIndex) listIndexModel.getItem(500); | ||
assertNotNull(item500); | ||
assertEquals(500, item500.getIndex()); | ||
} | ||
} |