-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add cacheGroupedBy query fix: Don't double count entities in cacheGrouped/AssociatedBy by observing correct events, and limiting to involved components fix: OnRemove not firing when entity removed
- Loading branch information
Showing
10 changed files
with
109 additions
and
26 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
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 |
---|---|---|
|
@@ -6,6 +6,8 @@ class OnAdd | |
|
||
class OnSet | ||
|
||
class OnFirstSet | ||
|
||
class OnRemove | ||
|
||
class OnUpdate | ||
|
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
26 changes: 26 additions & 0 deletions
26
geary-core/src/jvmTest/kotlin/com/mineinabyss/geary/observers/QueryAsMapTest.kt
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,26 @@ | ||
package com.mineinabyss.geary.observers | ||
|
||
import com.mineinabyss.geary.events.queries.cacheAssociatedBy | ||
import com.mineinabyss.geary.helpers.entity | ||
import com.mineinabyss.geary.helpers.tests.GearyTest | ||
import com.mineinabyss.geary.modules.geary | ||
import com.mineinabyss.geary.systems.query.query | ||
import io.kotest.matchers.shouldBe | ||
import org.junit.jupiter.api.Test | ||
|
||
class QueryAsMapTest : GearyTest() { | ||
@Test | ||
fun `should correctly track entity in map`() { | ||
val map = geary.cacheAssociatedBy(query<String>()) { (string) -> string } | ||
|
||
entity { | ||
set("Hello world") | ||
map["Hello world"] shouldBe this | ||
remove<String>() | ||
map["Hello world"] shouldBe null | ||
set("Hello world") | ||
removeEntity() | ||
map["Hello world"] shouldBe null | ||
} | ||
} | ||
} |
File renamed without changes.
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