Skip to content

Commit

Permalink
Adds basic test to cover constructor overload paths
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsilber committed Dec 21, 2023
1 parent 5bb051c commit 155d0a0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import com.jackpocket.scratchoff.LoggingScratchoffController
import com.jackpocket.scratchoff.ScratchoffController
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Test
import org.junit.runner.RunWith

Expand All @@ -24,6 +25,12 @@ class ScratchableLinearLayoutTests {

val controller = layout.scratchoffController as LoggingScratchoffController

@Test
fun testConstructorOverloads() {
assertNotNull(ScratchableLinearLayout(context, null).scratchoffController)
assertNotNull(ScratchableLinearLayout(context, null, 0).scratchoffController)
}

@Test
fun testViewsDelegateOnDrawEvents() {
assertEquals(0, controller.drawCount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import com.jackpocket.scratchoff.LoggingScratchoffController
import com.jackpocket.scratchoff.ScratchoffController
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Test
import org.junit.runner.RunWith

Expand All @@ -24,6 +25,12 @@ class ScratchableRelativeLayoutTests {

val controller = layout.scratchoffController as LoggingScratchoffController

@Test
fun testConstructorOverloads() {
assertNotNull(ScratchableRelativeLayout(context, null).scratchoffController)
assertNotNull(ScratchableRelativeLayout(context, null, 0).scratchoffController)
}

@Test
fun testViewsDelegateOnDrawEvents() {
assertEquals(0, controller.drawCount)
Expand Down

0 comments on commit 155d0a0

Please sign in to comment.