Add snapshot test for room item
This commit is contained in:
parent
6f934e2d49
commit
ab43f4cf14
@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2022 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package im.vector.app.screenshot
|
||||||
|
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.TextView
|
||||||
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
import androidx.core.view.isVisible
|
||||||
|
import im.vector.app.R
|
||||||
|
import im.vector.app.features.home.room.list.UnreadCounterBadgeView
|
||||||
|
import org.junit.Rule
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
class RoomItemScreenshotTest {
|
||||||
|
|
||||||
|
@get:Rule
|
||||||
|
val paparazzi = createPaparazziRule()
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `item room test`() {
|
||||||
|
val view = paparazzi.inflate<ConstraintLayout>(R.layout.item_room)
|
||||||
|
|
||||||
|
view.findViewById<View>(R.id.roomUnreadIndicator).isVisible = true
|
||||||
|
view.findViewById<TextView>(R.id.roomNameView).text = "Room name"
|
||||||
|
view.findViewById<TextView>(R.id.roomLastEventTimeView).text = "12:34"
|
||||||
|
view.findViewById<TextView>(R.id.subtitleView).text = "Latest message"
|
||||||
|
view.findViewById<View>(R.id.roomDraftBadge).isVisible = true
|
||||||
|
view.findViewById<UnreadCounterBadgeView>(R.id.roomUnreadCounterBadgeView).let {
|
||||||
|
it.isVisible = true
|
||||||
|
it.render(UnreadCounterBadgeView.State.Count(8, false))
|
||||||
|
}
|
||||||
|
|
||||||
|
paparazzi.snapshot(view)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `item room two line and highlight test`() {
|
||||||
|
val view = paparazzi.inflate<ConstraintLayout>(R.layout.item_room)
|
||||||
|
|
||||||
|
view.findViewById<View>(R.id.roomUnreadIndicator).isVisible = true
|
||||||
|
view.findViewById<TextView>(R.id.roomNameView).text = "Room name"
|
||||||
|
view.findViewById<TextView>(R.id.roomLastEventTimeView).text = "23:59"
|
||||||
|
view.findViewById<TextView>(R.id.subtitleView).text = "Latest message\nOn two lines"
|
||||||
|
view.findViewById<View>(R.id.roomDraftBadge).isVisible = true
|
||||||
|
view.findViewById<UnreadCounterBadgeView>(R.id.roomUnreadCounterBadgeView).let {
|
||||||
|
it.isVisible = true
|
||||||
|
it.render(UnreadCounterBadgeView.State.Count(88, true))
|
||||||
|
}
|
||||||
|
|
||||||
|
paparazzi.snapshot(view)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:d33e82c6647bab9dcb3745d8c5a5448d60049279c365b9f64816eb9c958360d2
|
||||||
|
size 15015
|
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:91a106e2a3f7310ac05425a2413ccec0aaa07720609d77a2ecd9a9d0d602b296
|
||||||
|
size 17232
|
Loading…
x
Reference in New Issue
Block a user