File tree Expand file tree Collapse file tree 6 files changed +28
-14
lines changed
main/java/devmike/jade/com Expand file tree Collapse file tree 6 files changed +28
-14
lines changed Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ android {
1212 defaultConfig {
1313 minSdkVersion 14
1414 targetSdkVersion 32
15- versionCode 1
16- versionName " 2.0.0"
15+ versionCode 2
16+ versionName " 2.0.0-beta1 "
1717 testInstrumentationRunner " androidx.test.runner.AndroidJUnitRunner"
1818 }
1919 buildTypes {
Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ import android.annotation.SuppressLint
44import androidx.viewpager.widget.ViewPager
55
66interface PageStepIndicator {
7- fun setOffset (position : Int , positionOffset : Float )
87
98 fun setPagerScrollState (state : Int )
109
Original file line number Diff line number Diff line change @@ -104,8 +104,6 @@ public boolean disablePageChange() {
104104 return disablePageChange ;
105105 }
106106
107-
108- @ Override
109107 public void setOffset (int position , float positionOffset ) {
110108 this .offset = positionOffset ;
111109 offsetPixel = Math .round (stepDistance * offset );
Original file line number Diff line number Diff line change 11import fakes.FakePageStepIndicator
2+ import org.junit.After
23import org.junit.Assert.assertEquals
34import org.junit.Before
45import org.junit.Test
@@ -8,16 +9,31 @@ import org.junit.runners.JUnit4
89@RunWith(JUnit4 ::class )
910class PageIndicatorTest {
1011
11- lateinit var pageStepIndicator : FakePageStepIndicator
12+ var pageStepIndicator : FakePageStepIndicator ? = null
1213
1314 @Before
1415 fun `init` (){
1516 pageStepIndicator = FakePageStepIndicator ()
1617 }
1718
1819 @Test
19- fun `check setOffset ` (){
20+ fun `check value passed into setCurrentPosition is correct ` (){
21+ pageStepIndicator?.setCurrentPosition(4 )
22+ assertEquals(pageStepIndicator?.getCurrentStepPosition(), 4 )
23+ }
24+
25+ @Test
26+ fun `Check setPagerScrollState` (){
27+ pageStepIndicator?.setPagerScrollState(43 )
28+ assertEquals(pageStepIndicator?.state, 43 )
29+
30+ }
31+
32+
2033
34+ @After
35+ fun `tear down` (){
36+ pageStepIndicator = null ;
2137 }
2238
2339}
Original file line number Diff line number Diff line change @@ -6,15 +6,18 @@ class FakePageStepIndicator : PageStepIndicator {
66
77 private var currentStepPosition = 0
88
9- override fun setOffset (position : Int , positionOffset : Float ) {
10- this .currentStepPosition = position
11- }
9+ var state = 0
1210
1311 override fun setPagerScrollState (state : Int ) {
14- currentStepPosition = state
12+ this .state = state
1513 }
1614
1715 override fun setCurrentPosition (position : Int ) {
1816 this .currentStepPosition = position
1917 }
18+
19+ fun getCurrentStepPosition (): Int {
20+ return currentStepPosition
21+ }
22+
2023}
Original file line number Diff line number Diff line change @@ -11,9 +11,7 @@ class FakePageStepIndicatorViewPager : PageStepIndicatorViewPager<MockViewPager>
1111
1212 private var stepCount = 0
1313
14- override fun setupWithViewPager (viewPager : MockViewPager ) {
15-
16- }
14+ override fun setupWithViewPager (viewPager : MockViewPager ) {}
1715
1816 override fun getPageStepIndicator (): PageStepIndicator {
1917 return FakePageStepIndicator ()
You can’t perform that action at this time.
0 commit comments