Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
package com.sdds.compose.uikit.fixtures.testcases

import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.sdds.compose.uikit.IconButton
import com.sdds.compose.uikit.Text
import com.sdds.compose.uikit.ai.AiHeader
import com.sdds.compose.uikit.ai.AiHeaderSeparationType
import com.sdds.compose.uikit.ai.AiHeaderStyle
import com.sdds.compose.uikit.ai.AiHeaderTitleAlignment
import com.sdds.icons.R

/**
* Тест-кейсы для компонента [AiHeader]
*/

/**
* PLASMA-T2664, PLASMA-T2670
*/
@Composable
fun AiHeaderTitleSubtitleStartHasStartEndButton(
style: AiHeaderStyle,
) {
AiHeaderCommon(
style = style,
)
}

/**
* PLASMA-T2665
*/
@Composable
fun AiHeaderTitleSubtitleCenter(
style: AiHeaderStyle,
) {
AiHeaderCommon(
style = style,
titleAlignment = AiHeaderTitleAlignment.Center,
actionBefore = null,
actionAfter = null,
)
}

/**
* PLASMA-T2666
*/
@Composable
fun AiHeaderTitleHasDividerStartButton(
style: AiHeaderStyle,
) {
AiHeaderCommon(
style = style,
separationType = AiHeaderSeparationType.Divider,
subtitleContent = null,
titleAlignment = AiHeaderTitleAlignment.End,
actionAfter = null,
)
}

/**
* PLASMA-T2667
*/
@Composable
fun AiHeaderNoTitleEndButton(
style: AiHeaderStyle,
) {
AiHeaderCommon(
style = style,
titleContent = null,
actionBefore = null,
)
}

/**
* PLASMA-T2668
*/
@Composable
fun AiHeaderLongTitleSubtitleDividerCenter(
style: AiHeaderStyle,
) {
AiHeaderCommon(
style = style,
separationType = AiHeaderSeparationType.Divider,
titleAlignment = AiHeaderTitleAlignment.Center,
titleContent = {
Text(
"There is no one who loves pain itself, who seeks after " +
"it and wants to have it, simply because it is pain",
)
},
subtitleContent = {
Text(
"Lorem Ipsum is simply dummy text of the printing and " +
"typesetting industry. Lorem Ipsum has been the industry's standard dummy " +
"text ever since the 1500s, when an unknown printer took a galley of type " +
"and scrambled it to make a type specimen book.",
)
},
)
}

/**
* PLASMA-T2669, PLASMA-T2672
*/
@Composable
fun AiHeaderTitleAlignmentEndStartEndButton(
style: AiHeaderStyle,
) {
AiHeaderCommon(
style = style,
titleAlignment = AiHeaderTitleAlignment.End,
)
}

/**
* PLASMA-T2671
*/
@Composable
fun AiHeaderCenterStartEndButton(
style: AiHeaderStyle,
) {
AiHeaderCommon(
style = style,
titleAlignment = AiHeaderTitleAlignment.Center,
)
}

/**
* Общий тест-кейс
*/
@Composable
fun AiHeaderCommon(
modifier: Modifier = Modifier,
style: AiHeaderStyle,
separationType: AiHeaderSeparationType = AiHeaderSeparationType.None,
actionBefore: (@Composable () -> Unit)? = {
IconButton(
iconRes = R.drawable.ic_panel_sidebar_l_outline_24,
onClick = {},
)
},
actionAfter: @Composable (() -> Unit)? = {
IconButton(iconRes = R.drawable.ic_close_24, onClick = {})
},
titleContent: @Composable (() -> Unit)? = {
Text(text = "Заголовок")
},
subtitleContent: @Composable (() -> Unit)? = {
Text(text = "Подзаголовок")
},
titleAlignment: AiHeaderTitleAlignment = AiHeaderTitleAlignment.Start,
) {
AiHeader(
modifier = modifier.fillMaxWidth(),
style = style,
separationType = separationType,
actionBefore = actionBefore,
actionAfter = actionAfter,
titleContent = titleContent,
subtitleContent = subtitleContent,
titleAlignment = titleAlignment,
)
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
package com.sdds.serv

import com.github.takahirom.roborazzi.RobolectricDeviceQualifiers
import com.sdds.compose.uikit.fixtures.RoborazziConfigCompose
import com.sdds.compose.uikit.fixtures.SDK_NUMBER
import com.sdds.compose.uikit.fixtures.testcases.AiHeaderCenterStartEndButton
import com.sdds.compose.uikit.fixtures.testcases.AiHeaderLongTitleSubtitleDividerCenter
import com.sdds.compose.uikit.fixtures.testcases.AiHeaderNoTitleEndButton
import com.sdds.compose.uikit.fixtures.testcases.AiHeaderTitleAlignmentEndStartEndButton
import com.sdds.compose.uikit.fixtures.testcases.AiHeaderTitleHasDividerStartButton
import com.sdds.compose.uikit.fixtures.testcases.AiHeaderTitleSubtitleCenter
import com.sdds.compose.uikit.fixtures.testcases.AiHeaderTitleSubtitleStartHasStartEndButton
import com.sdds.compose.uikit.style.style
import com.sdds.serv.styles.aiheader.AiHeader
import com.sdds.serv.styles.aiheader.Clear
import com.sdds.serv.styles.aiheader.Default
import com.sdds.serv.styles.aiheader.H2
import com.sdds.serv.styles.aiheader.H3
import com.sdds.serv.styles.aiheader.H4
import com.sdds.serv.styles.aiheader.H5
import com.sdds.serv.styles.aiheader.L
import com.sdds.serv.styles.aiheader.M
import com.sdds.serv.styles.aiheader.S
import com.sdds.serv.styles.aiheader.Secondary
import com.sdds.serv.styles.aiheader.Xl
import com.sdds.serv.styles.aiheader.Xs
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.ParameterizedRobolectricTestRunner
import org.robolectric.annotation.Config
import org.robolectric.annotation.GraphicsMode

@RunWith(ParameterizedRobolectricTestRunner::class)
@GraphicsMode(GraphicsMode.Mode.NATIVE)
@Config(sdk = [SDK_NUMBER], qualifiers = RobolectricDeviceQualifiers.Pixel6)
class ComposeAiHeaderScreenshotTest(
theme: String,
) : RoborazziConfigCompose(theme) {

@Test
fun testAiHeaderXlDefaultTitleSubtitleStartHasStartEndButton() {
composeTestRule.content {
AiHeaderTitleSubtitleStartHasStartEndButton(AiHeader.Xl.Default.style())
}
}

@Test
fun testAiHeaderLSecondaryTitleSubtitleCenter() {
composeTestRule.content {
AiHeaderTitleSubtitleCenter(AiHeader.L.Secondary.style())
}
}

@Test
fun testAiHeaderMClearTitleHasDividerStartButton() {
composeTestRule.content {
AiHeaderTitleHasDividerStartButton(AiHeader.M.Clear.style())
}
}

@Test
fun testAiHeaderSDefaultNoTitleEndButton() {
composeTestRule.content {
AiHeaderNoTitleEndButton(AiHeader.S.Default.style())
}
}

@Test
fun testAiHeaderLongTitleSubtitleDividerCenter() {
composeTestRule.content {
AiHeaderLongTitleSubtitleDividerCenter(AiHeader.Xs.Secondary.style())
}
}

@Test
fun testAiHeaderH5ClearTitleAlignmentEndStartEndButton() {
composeTestRule.content {
AiHeaderTitleAlignmentEndStartEndButton(AiHeader.H5.Clear.style())
}
}

@Test
fun testAiHeaderH4DefaultTitleSubtitleStartHasStartEndButton() {
composeTestRule.content {
AiHeaderTitleSubtitleStartHasStartEndButton(AiHeader.H4.Default.style())
}
}

@Test
fun testAiHeaderH3DefaultCenterStartEndButton() {
composeTestRule.content {
AiHeaderCenterStartEndButton(AiHeader.H3.Default.style())
}
}

@Test
fun testAiHeaderH2DefaultTitleAlignmentEndStartEndButton() {
composeTestRule.content {
AiHeaderTitleAlignmentEndStartEndButton(AiHeader.H2.Default.style())
}
}
}
Loading