가로모드 지원. 스크롤 가능하게
자동으로 가로모드가 지원되지만 스크롤은 안된다.
최상위 컴포저블의 modifier에서 아래의 코드 추가
verticalScroll(rememberScrollState())
여백 설정
Modifier | 설명 |
statusBarsPadding() | 상단(status bar) 높이만큼 padding |
safeDrawingPadding() | 상단 + 하단 + 양옆 등 모든 시스템 UI를 고려해서 안전한 padding |
asis | tobe |
![]() |
![]() |
KeyboardOptions
속성 | 키보드의 작업버튼 |
ImeAction.Search | ![]() |
ImeAction.Send | ![]() |
ImeAction.Go | ![]() |
계측테스트 (Implementation test)
Web 개발자로 치자면 e2e 테스트라고 보면 된다. 예) cypress
테스트 코드로 자동으로 적절한 노드를 선택해 값을 입력하고 결과를 확인하는 방식
테스트 실행 하면 실제 에뮬레이터를 띄운 후 TC가 돌아간다 (cypress도 마찬가지)
만드는 순서
- project view 에서 src 디렉토리 기준으로 /androidTest/java 디렉토리를 만든다
- main과 똑같은 package 구조를 만든다. 예) com.example.tiptime
- 해당 package에서 TipUITest class 생성
class TipUITests {
@get:Rule
val composeTestRule = createComposeRule() // MainActivity.kt파일의 onCreate()처럼 동작하기 위해
@Test
fun calculate_20_percent_tip() {
composeTestRule.setContent {
TipTimeTheme {
TipTimeLayout()
}
}
composeTestRule.onNodeWithText("Bill Amount").performTextInput("10")
composeTestRule.onNodeWithText("Tip Percentage").performTextInput("20")
val expectedTip = NumberFormat.getCurrencyInstance().format(2)
composeTestRule.onNodeWithText("Tip Amount: $expectedTip").assertExists(
"No node with this text was found."
)
}
}
'IT > android' 카테고리의 다른 글
#6 나만 헷갈렸나? Jackpot Compose 테마 적용 (0) | 2025.05.20 |
---|---|
#5 나만 헷갈렸나? Jackpot Compose > LazyColumn, Icon (0) | 2025.05.19 |
#4 나만 헷갈렸나? Jackpot Compose > 코틀린 문법 (2) | 2025.05.17 |
#2 나만 헷갈렸나? Jackpot Compose > 재구성, wrapContentSize (0) | 2025.05.15 |
#1 나만 헷갈렸나? Jackpot Compose > Column, Row, Arragement, Alignment, Text 정렬 (0) | 2025.05.14 |