Skip to content

Commit 174a7b8

Browse files
committed
Bump to 1.3.5
1 parent aba8faf commit 174a7b8

File tree

2 files changed

+56
-2
lines changed

2 files changed

+56
-2
lines changed

fancyshowcaseview/src/test/java/me/toptas/fancyshowcase/PresenterTest.kt

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ class PresenterTest {
2424
private val device: DeviceParams = mock()
2525
private val props = Properties()
2626

27+
/**
28+
* Set initial device values
29+
*/
2730
@Before
2831
fun setup() {
2932
whenever(device.currentBackgroundColor()).thenReturn(100)
@@ -32,6 +35,9 @@ class PresenterTest {
3235
whenever(device.getStatusBarHeight()).thenReturn(80)
3336
}
3437

38+
/**
39+
* Check initial styles & properties
40+
*/
3541
@Test
3642
fun testInitialValues() {
3743
val presenter = Presenter(pref, device, props)
@@ -44,6 +50,9 @@ class PresenterTest {
4450
assert(presenter.centerY == 960)
4551
}
4652

53+
/**
54+
* Default background color
55+
*/
4756
@Test
4857
fun testDefaultBgColor() {
4958
props.backgroundColor = 200
@@ -52,6 +61,9 @@ class PresenterTest {
5261
assert(props.backgroundColor == 200)
5362
}
5463

64+
/**
65+
* Title gravity
66+
*/
5567
@Test
5668
fun testGravity() {
5769
val presenter = Presenter(pref, device, props)
@@ -61,6 +73,9 @@ class PresenterTest {
6173
assert(props.titleGravity == Gravity.TOP)
6274
}
6375

76+
/**
77+
* Title style
78+
*/
6479
@Test
6580
fun testTitleStyle() {
6681
val presenter = Presenter(pref, device, props)
@@ -70,6 +85,9 @@ class PresenterTest {
7085
assert(props.titleStyle == 101)
7186
}
7287

88+
/**
89+
* If view with same id show before, don't show again
90+
*/
7391
@Test
7492
fun testNotShownBefore() {
7593
whenever(pref.isShownBefore(anyVararg())).thenReturn(false)
@@ -86,6 +104,9 @@ class PresenterTest {
86104
assert(onShowTriggered)
87105
}
88106

107+
/**
108+
* Wait for laid out if try to show before laid out
109+
*/
89110
@Test
90111
fun testViewNotLaidOut() {
91112
whenever(pref.isShownBefore(anyVararg())).thenReturn(false)
@@ -103,6 +124,9 @@ class PresenterTest {
103124
assert(!onShowTriggered)
104125
}
105126

127+
/**
128+
* Test dismissListener triggers if shown before
129+
*/
106130
@Test
107131
fun testShownBefore() {
108132
whenever(pref.isShownBefore(anyVararg())).thenReturn(true)
@@ -120,8 +144,11 @@ class PresenterTest {
120144
}
121145

122146

147+
/**
148+
* Test dismissListener triggers if shown before
149+
*/
123150
@Test
124-
fun testFocus() {
151+
fun `test dismissListener onSkipped is not called if not shown before`() {
125152
whenever(pref.isShownBefore(anyVararg())).thenReturn(false)
126153
props.focusedView = mock()
127154
props.dismissListener = mock()
@@ -136,6 +163,9 @@ class PresenterTest {
136163
assert(onShowTriggered)
137164
}
138165

166+
/**
167+
* Test calculated height before focus
168+
*/
139169
@Test
140170
fun testCalculationsWithoutFocus() {
141171
val presenter = Presenter(pref, device, props)
@@ -149,6 +179,9 @@ class PresenterTest {
149179
assert(presenter.bitmapHeight == 1920)
150180
}
151181

182+
/**
183+
* Test calculated values
184+
*/
152185
@Test
153186
fun testCalculationsWithFocus() {
154187
val presenter = Presenter(pref, device, props)
@@ -164,6 +197,9 @@ class PresenterTest {
164197
assert(presenter.circleCenterY == 120)
165198
}
166199

200+
/**
201+
* Test calculated values for abobe 19 devices
202+
*/
167203
@Test
168204
fun testCalculationsWithFocus2() {
169205
val presenter = Presenter(pref, device, props)
@@ -180,13 +216,19 @@ class PresenterTest {
180216
assert(presenter.circleCenterY == 200)
181217
}
182218

219+
/**
220+
* Set pref
221+
*/
183222
@Test
184223
fun testWriteShown() {
185224
val presenter = Presenter(pref, device, props)
186225
presenter.writeShown("id")
187226
verify(pref).writeShown("id")
188227
}
189228

229+
/**
230+
* Circle focus position
231+
*/
190232
@Test
191233
fun testFocusPositionsCircle() {
192234
val presenter = Presenter(pref, device, props)
@@ -202,6 +244,9 @@ class PresenterTest {
202244
assert(presenter.hasFocus)
203245
}
204246

247+
/**
248+
* Rectangle focus position
249+
*/
205250
@Test
206251
fun testFocusPositionsRectangle() {
207252
val presenter = Presenter(pref, device, props)
@@ -221,6 +266,9 @@ class PresenterTest {
221266

222267
}
223268

269+
/**
270+
* Auto text position calculations below
271+
*/
224272
@Test
225273
fun testAutoTextPositionBelow() {
226274
val presenter = Presenter(pref, device, props)
@@ -238,6 +286,9 @@ class PresenterTest {
238286
assert(pos.height == 1770)
239287
}
240288

289+
/**
290+
* Auto text position calculations above
291+
*/
241292
@Test
242293
fun testAutoTextPositionAbove() {
243294
val presenter = Presenter(pref, device, props)
@@ -256,6 +307,9 @@ class PresenterTest {
256307
assert(pos.height == 1200)
257308
}
258309

310+
/**
311+
* Click in the focused zone
312+
*/
259313
@Test
260314
fun testClickWithinZoneCircle() {
261315
val presenter = Presenter(pref, device, props)

versions.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ buildscript {
33
ext.compile_sdk_version = 28
44
ext.min_sdk_version = 14
55
ext.target_sdk_version = 28
6-
ext.version_name = '1.3.4'
6+
ext.version_name = '1.3.5'
77
ext.appcompat = '1.2.0'
88
ext.material = '1.2.1'
99
}

0 commit comments

Comments
 (0)