sprint-1 #1

Merged
user10 merged 20 commits from sprint-1 into main 2025-05-26 14:29:49 +00:00
6 changed files with 120 additions and 2 deletions
Showing only changes of commit a8e5a262d9 - Show all commits

View File

@ -1,11 +1,33 @@
package com.example.libary
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import org.junit.Rule
import org.junit.Test
class BottomSheetTest {
@get:Rule
val composeRule = createComposeRule()
@Test
fun test1() {
composeRule.setContent {
val ins = remember { mutableStateOf("") }
Select(
value = ins,
data = listOf(
"test1"
)
)
}
composeRule.onNodeWithTag("dr_1").performClick()
composeRule.onNodeWithText("test1").assertIsDisplayed()
}
}

View File

@ -0,0 +1,22 @@
package com.example.libary
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.test.junit4.createComposeRule
import org.junit.Assert
import org.junit.Rule
import org.junit.Test
class ButtonChipTest {
@get:Rule
val composeRule = createComposeRule()
@Test
fun test() {
Assert.assertEquals(ChipButtonState.On.textColor, Color(0xFFFFFFFF))
Assert.assertEquals(ChipButtonState.On.containerColor, Color(0xFF1A6FEE))
Assert.assertEquals(ChipButtonState.Off.textColor, Color(0xFF7E7E9A))
Assert.assertEquals(ChipButtonState.Off.containerColor, Color(0xFFF5F5F9))
}
}

View File

@ -0,0 +1,26 @@
package com.example.libary
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithText
import org.junit.Rule
import org.junit.Test
class InputTest {
@get:Rule
val composeRule = createComposeRule()
@Test
fun test1() {
composeRule.setContent {
Input(
value = "",
onValueChange = {},
errorText = "error test"
)
}
composeRule.onNodeWithText("error test").assertIsDisplayed()
}
}

View File

@ -0,0 +1,46 @@
package com.example.libary
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.performClick
import androidx.compose.ui.unit.dp
import org.junit.Assert
import org.junit.Rule
import org.junit.Test
class TabbarTest {
@get:Rule
val composeRule = createComposeRule()
@Test
fun test() {
var valueName = ""
composeRule.setContent {
val value = remember { mutableStateOf(defaultTabBarData[0]) }
LaunchedEffect(value.value) {
valueName = value.value.name
}
Column {
Spacer(Modifier.height(100.dp))
TabBar(
value = value
)
}
}
composeRule.onNodeWithTag("Главная").performClick()
Assert.assertEquals(valueName, "Главная")
}
}

View File

@ -17,6 +17,7 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
@ -65,7 +66,7 @@ fun Select(
Image(
painter = painterResource(R.drawable.dr_1),
contentDescription = null,
modifier = Modifier.clickable {
modifier = Modifier.testTag("dr_1").clickable {
modal = true
}
)

View File

@ -19,6 +19,7 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
@ -26,7 +27,6 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.example.libary.theme.AccentColor
import com.example.libary.theme.IconsColor
import com.example.libary.theme.InputIconColor
import com.example.libary.theme.TabBarShad
data class TabBarData(
@ -71,6 +71,7 @@ fun TabBar(
data.forEach {
NavigationBarItem(
selected = value.value == it,
modifier = Modifier.testTag(it.name),
colors = NavigationBarItemDefaults.colors(
indicatorColor = Color.Transparent
),