Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
renetik committed Jul 21, 2023
1 parent e7998fd commit c6b5f46
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import renetik.android.core.java.lang.nanoTime
import renetik.android.core.kotlin.collections.removeValue
import renetik.android.core.lang.variable.CSVariable.Companion.variable
import renetik.android.core.logging.CSLog.logWarnTrace
import renetik.android.event.common.CSHasDestruct

class CSRegistrationsMap(
private val parent: Any,
private val parent: CSHasDestruct,
) : CSRegistrations, CSHasRegistrations {

override val registrations: CSRegistrationsMap = this
Expand All @@ -17,10 +18,10 @@ class CSRegistrationsMap(
private set

@get:Synchronized
override var isCanceled: Boolean = false
override var isCanceled: Boolean = parent.isDestructed
private set

private val registrationMap: MutableMap<String, CSRegistration> = mutableMapOf()
private val registrationMap: MutableMap<String, CSRegistration> by lazy(::mutableMapOf)
private var idCount: Int = 0
private fun createUniqueId() = "$idCount: $nanoTime".also { idCount++ }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ package renetik.android.event
import org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import renetik.android.core.logging.CSDummyLogger
import renetik.android.core.logging.CSLog.init
import renetik.android.event.CSEvent.Companion.event
import renetik.android.event.common.CSModel
import renetik.android.event.common.destruct
import renetik.android.event.registration.register

/**
* Event unregister after owner nulled
*/
@RunWith(RobolectricTestRunner::class)
class EventOwnerEventTest {

@Before
Expand Down Expand Up @@ -42,5 +42,4 @@ class EventOwnerEventTest {
event.fire()
assertEquals(0, count)
}

}

0 comments on commit c6b5f46

Please sign in to comment.