Skip to content
Merged
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
Expand Up @@ -102,7 +102,6 @@ import com.afternote.feature.receiver.presentation.R as ReceiverR
/** 이 테스트의 관심 밖인 외부 라우팅을 채우는 no-op 묶음. */
private val noopActions =
ReceiverHomeActions(
onSettingClick = {},
onNavigateToMindRecord = {},
onNavigateToTimeLetter = {},
onNavigateToAfternote = {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,6 @@ fun rememberReceiverNavActions(appState: AppState): ReceiverNavActions =
fun rememberReceiverHomeActions(appState: AppState): ReceiverHomeActions =
remember(appState) {
ReceiverHomeActions(
onSettingClick = { appState.navController.navigate(Route.Setting) },
onNavigateToMindRecord = { appState.navController.navigate(Route.ReceiverMindRecord) },
onNavigateToTimeLetter = { appState.navController.navigate(Route.TimeLetter) },
onNavigateToAfternote = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package com.afternote.feature.receiver.presentation.home
* 데이터 로드/다운로드는 ViewModel이 관할하고, 외부 화면 이동만 호출 측이 채운다.
*/
data class ReceiverHomeActions(
val onSettingClick: () -> Unit,
val onNavigateToMindRecord: () -> Unit,
val onNavigateToTimeLetter: () -> Unit,
val onNavigateToAfternote: () -> Unit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,15 @@ fun ReceiverHomeScreen(
modifier = modifier,
containerColor = Color.Transparent,
topBar = {
// 수신자에게 유효한 헤더 액션이 없다 — 둘 다 그리지 않는다 (#613).
//
// 프로필 아이콘은 목적지가 없는 장식이었고, 톱니는 **회원 설정 화면**을 그대로 열었다.
// 수신자는 로그인한 적이 없는 사용자(`X-Auth-Code` 기반)라 그 화면의 유일한 항목인
// 「로그아웃」에 지울 세션이 없다. 수신자용 설정 계약이 생기기 전까지 새 화면이나
// 가짜 로그아웃을 지어내지 않고 진입점을 내린다(#613 디자인 게이트 해제).
HomeTopBar(
showProfileIcon = false,
onSettingClick = actions.onSettingClick,
onSettingClick = null,
)
},
snackbarHost = { SnackbarHost(snackbarHostState) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import com.android.tools.screenshot.PreviewTest
/** baseline 은 화면 픽셀만 본다 — 외부 라우팅은 눌리지 않으므로 빈 액션으로 채운다. */
private val noopActions =
ReceiverHomeActions(
onSettingClick = {},
onNavigateToMindRecord = {},
onNavigateToTimeLetter = {},
onNavigateToAfternote = {},
Expand Down
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
Expand Up @@ -17,7 +17,6 @@ import org.robolectric.annotation.GraphicsMode
/** 이 테스트의 관심 밖인 외부 라우팅을 채우는 no-op 묶음. */
private val noopActions =
ReceiverHomeActions(
onSettingClick = {},
onNavigateToMindRecord = {},
onNavigateToTimeLetter = {},
onNavigateToAfternote = {},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.afternote.feature.receiver.presentation.home

import androidx.activity.ComponentActivity
import androidx.compose.ui.test.assertCountEquals
import androidx.compose.ui.test.assertHasClickAction
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.hasClickAction
import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.compose.ui.test.onNodeWithContentDescription
import androidx.compose.ui.test.onNodeWithTag
Expand All @@ -19,7 +21,6 @@ import org.robolectric.annotation.Config
/** 이 테스트의 관심 밖인 외부 라우팅을 채우는 no-op 묶음. */
private val noopActions =
ReceiverHomeActions(
onSettingClick = {},
onNavigateToMindRecord = {},
onNavigateToTimeLetter = {},
onNavigateToAfternote = {},
Expand Down Expand Up @@ -60,19 +61,39 @@ class ReceiverHomeHeaderTest {
}

@Test
fun `설정 아이콘은 이름이 있고 눌린다`() {
var settingClicks = 0
fun `설정 아이콘을 그리지 않는다`() {
// 톱니는 **회원 설정 화면**을 그대로 열었고, 그 화면의 유일한 항목이 「로그아웃」이다.
// 수신자는 로그인한 적이 없는 사용자(X-Auth-Code 기반)라 지울 세션이 없다 (#613).
//
// 「이름이 있고 눌린다」를 단언하던 자리를 뒤집는다 — 진입점 자체가 없어야 한다.
composeRule.setContent {
AfternoteTheme {
ReceiverHomeScreen(
uiState = ReceiverHomeUiState.Loading,
onEvent = {},
actions = noopActions.copy(onSettingClick = { settingClicks += 1 }),
actions = noopActions,
)
}
}

val setting = composeRule.activity.getString(R.string.core_ui_home_top_bar_setting)
composeRule.onNodeWithContentDescription(setting).assertIsDisplayed().assertHasClickAction()
composeRule.onNodeWithContentDescription(setting).assertDoesNotExist()
}

@Test
fun `헤더에 누를 수 있는 액션이 하나도 없다`() {
// 개별 아이콘을 이름으로 확인하는 것과 별개로, 「헤더에 회원 액션이 새로 생기지 않는다」를
// 통째로 고정한다 — 새 아이콘이 추가되면 이름을 모르니 위 두 단언은 그대로 통과한다.
composeRule.setContent {
AfternoteTheme {
ReceiverHomeScreen(
uiState = ReceiverHomeUiState.Loading,
onEvent = {},
actions = noopActions,
)
}
}

composeRule.onAllNodes(hasClickAction()).assertCountEquals(0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[minor] 머지를 막지 않습니다 — 다만 이 단언은 «헤더» 가 아니라 화면 전체를 셉니다.

지금 통과하는 이유는 ReceiverHomeScreen 의 ReceiverHomeUiState.Loading -> { } 가 본문을 아무것도 그리지 않기 때문입니다. 즉 헤더만 남은 상태라 우연히 이름과 결과가 맞아떨어집니다. 두 방향으로 어긋납니다.

  • 로딩에 스켈레톤 버튼이나 «취소» 하나만 생겨도, 헤더와 무관한 이유로 이 테스트가 red 가 됩니다.
  • 반대로 Success 상태에서만 톱니가 되살아나는 회귀는 못 잡습니다 — 두 테스트 다 Loading 만 태웁니다. 지금 코드는 상태와 무관하게 같은 HomeTopBar 한 곳이라 실질 구멍은 아니지만, 이 테스트가 막겠다고 적은 «이름을 모르는 새 아이콘» 은 그 헤더가 상태별로 갈리는 순간 빠져나갑니다.

HomeTopBar 에 이미 PROFILE_ICON_TEST_TAG 같은 앵커를 쓰는 선례가 있으니, 탑바 서브트리로 좁히거나(onNode(hasTestTag(...)).onChildren()) 최소한 Success 상태도 함께 태우면 이름과 실체가 맞습니다.

}
}
Loading