feat: library and store tabs per store with installed games listed first (#1116)

This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-10-19 02:06:38 -04:00
1 parent 7370145f89
commit 5970de928e
37 files changed
+199 -205

No files matched your search

@@ -26,4 +26,29 @@ class StoreGridNavigationTest {
assertEquals(5, storeGridNeighbor(2, 10, 3, 1))
assertEquals(6, storeGridNeighbor(2, 10, 4, 1))
}
@Test fun downFromTheInstalledSectionLandsInTheSameColumnBelowTheDivider() {
assertEquals(6, storeGridNeighbor(0, 12, 4, 1, split = 6).let { storeGridNeighbor(it!!, 12, 4, 1, split = 6) })
assertEquals(6, storeGridNeighbor(4, 12, 4, 1, split = 6))
assertEquals(7, storeGridNeighbor(5, 12, 4, 1, split = 6))
assertEquals(8, storeGridNeighbor(2, 12, 4, 1, split = 6))
}
@Test fun upFromBelowTheDividerClampsToTheShortInstalledRow() {
assertEquals(4, storeGridNeighbor(6, 12, 4, -1, split = 6))
assertEquals(5, storeGridNeighbor(7, 12, 4, -1, split = 6))
assertEquals(5, storeGridNeighbor(9, 12, 4, -1, split = 6))
assertEquals(6, storeGridNeighbor(10, 12, 4, -1, split = 6))
}
@Test fun lastSectionStillStopsAtItsIncompleteRow() {
assertNull(storeGridNeighbor(9, 11, 4, 1, split = 6))
assertEquals(10, storeGridNeighbor(6, 11, 4, 1, split = 6))
assertNull(storeGridNeighbor(1, 11, 4, -1, split = 6))
}
@Test fun installedGamesComeFirstKeepingTheirSortedOrder() {
val items = listOf("a", "b", "c", "d").map { com.droiddeck.launcher.stores.CatalogItem(com.droiddeck.launcher.stores.Store.GOG, it, it, null) }
assertEquals(listOf("b", "d", "a", "c"), installedFirst(items, setOf("d", "b")).map { it.id })
}
}
@@ -5,12 +5,13 @@ import org.junit.Assert.assertEquals
import org.junit.Test
class StoreTabsTest {
@Test fun storeLibraryInstalledAmazonWithoutStore() {
assertEquals(listOf("store", "library", "installed"), tabsFor(Store.GOG))
assertEquals(listOf("library", "installed"), tabsFor(Store.AMAZON))
@Test fun libraryAndStoreAmazonLibraryOnly() {
assertEquals(listOf("library", "store"), tabsFor(Store.GOG))
assertEquals(listOf("library", "store"), tabsFor(Store.ITCH))
assertEquals(listOf("library"), tabsFor(Store.AMAZON))
assertEquals("library", tabFor(Store.AMAZON, "store"))
assertEquals("library", tabFor(Store.GOG, "all"))
assertEquals("installed", tabFor(Store.EPIC, "installed"))
assertEquals("library", tabFor(Store.EPIC, "installed"))
assertEquals("store", tabFor(Store.GOG, "store"))
}
}