Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
KDW03 committed Oct 30, 2023
2 parents 7b1b46b + 4fb2993 commit a076f42
Show file tree
Hide file tree
Showing 263 changed files with 17,099 additions and 2,296 deletions.
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# https://editorconfig.org/
# This configuration is used by ktlint when spotless invokes it

[*.{kt,kts}]
ij_kotlin_allow_trailing_comma=true
ij_kotlin_allow_trailing_comma_on_call_site=true
3 changes: 3 additions & 0 deletions .github/workflows/Build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ jobs:
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Check spotless
run: ./gradlew spotlessCheck --init-script gradle/init.gradle.kts --no-configuration-cache

- name: Run local tests
run: ./gradlew testDemoDebug

Expand Down
23 changes: 23 additions & 0 deletions .run/spotlessApply.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="spotlessApply" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--init-script=gradle/init.gradle.kts" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="spotlessApply" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>
29 changes: 20 additions & 9 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/*
* Copyright 2023 KDW03
*
* 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
*
* https://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.
*/
import com.najudoryeong.mineme.DoBuildType

plugins {
Expand Down Expand Up @@ -26,26 +41,23 @@ android {
buildTypes {
debug {
applicationIdSuffix = DoBuildType.DEBUG.applicationIdSuffix
manifestPlaceholders["appName"] = "Mineme (Debug)"
}
val release by getting {
isMinifyEnabled = true
applicationIdSuffix = DoBuildType.RELEASE.applicationIdSuffix
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
// To publish on the Play store a private signing key is required, but to allow anyone
// who clones the code to sign and run the release variant, use the debug signing key.
// TODO: Abstract the signing configuration to a separate file to avoid hardcoding this.
signingConfig = signingConfigs.getByName("debug")
manifestPlaceholders["appName"] = "Mineme"
}
create("benchmark") {
// Enable all the optimizations from release build through initWith(release).
initWith(release)
matchingFallbacks.add("release")
// Debug key signing is available to everyone.
signingConfig = signingConfigs.getByName("debug")
// Only use benchmark proguard rules
proguardFiles("benchmark-rules.pro")
isMinifyEnabled = true
applicationIdSuffix = DoBuildType.BENCHMARK.applicationIdSuffix
manifestPlaceholders["appName"] = "Mineme (Benchmark)"
}
}

Expand All @@ -60,6 +72,8 @@ android {
isIncludeAndroidResources = true
}
}


}
dependencies {

Expand All @@ -72,9 +86,6 @@ dependencies {
implementation(project(":core:designsystem"))
implementation(project(":core:data"))
implementation(project(":core:model"))
implementation(project(":core:analytics"))

implementation(project(":sync:work"))

androidTestImplementation(project(":core:testing"))
androidTestImplementation(project(":core:datastore-test"))
Expand Down
23 changes: 17 additions & 6 deletions app/src/androidTest/java/com/najudoryeong/mineme/DoAppStateTest.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2023 KDW03
*
* 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
*
* https://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 com.najudoryeong.mineme

import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi
Expand Down Expand Up @@ -35,11 +51,9 @@ class DoAppStateTest {

private val networkMonitor = TestNetworkMonitor()


// 테스트 대상
private lateinit var state: DoAppState


// AppState currentDestination이 잘 동작하는지
@Test
fun doAppState_currentDestination() = runTest {
Expand All @@ -66,7 +80,6 @@ class DoAppStateTest {
assertEquals("b", currentDestination)
}


// toLevelDestination이 올바른 개수,순서인지
@Test
fun doAppState_destinations() = runTest {
Expand All @@ -83,7 +96,6 @@ class DoAppStateTest {
assertTrue(state.topLevelDestinations[2].name.contains("settings", true))
}


@Test
fun doAppState_showBottomBar_compact() = runTest {
composeTestRule.setContent {
Expand All @@ -106,7 +118,7 @@ class DoAppStateTest {
navController = NavHostController(LocalContext.current),
coroutineScope = backgroundScope,
windowSizeClass = WindowSizeClass.calculateFromSize(DpSize(900.dp, 1200.dp)),
networkMonitor = networkMonitor
networkMonitor = networkMonitor,
)
}

Expand All @@ -121,7 +133,6 @@ class DoAppStateTest {
private fun getCompactWindowClass() = WindowSizeClass.calculateFromSize(DpSize(500.dp, 300.dp))
}


// TestNavHostController 설정
@Composable
private fun rememberTestNavController(): TestNavHostController {
Expand Down
42 changes: 18 additions & 24 deletions app/src/androidTest/java/com/najudoryeong/mineme/NavigationTest.kt
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
/*
* Copyright 2023 KDW03
*
* 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
*
* https://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 com.najudoryeong.mineme

import androidx.annotation.StringRes
import androidx.compose.ui.test.assertIsSelected
import androidx.compose.ui.test.hasText
import androidx.compose.ui.test.junit4.AndroidComposeTestRule
import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.compose.ui.test.onNodeWithContentDescription
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performClick
import androidx.test.espresso.Espresso
import androidx.test.espresso.NoActivityResumedException
import com.najudoryeong.mineme.core.model.data.DarkThemeConfig
import com.najudoryeong.mineme.core.model.data.UserData
import com.najudoryeong.mineme.core.testing.repository.TestUserDataRepository
import com.najudoryeong.mineme.core.ui.HomeUiState
import com.najudoryeong.mineme.core.ui.MainActivityUiState
import com.najudoryeong.mineme.core.ui.RegionStoryUiState
import dagger.hilt.android.testing.BindValue
import dagger.hilt.android.testing.HiltAndroidRule
import dagger.hilt.android.testing.HiltAndroidTest
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
import kotlinx.coroutines.test.UnconfinedTestDispatcher
import kotlinx.coroutines.test.runTest
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder
import javax.inject.Inject
import kotlin.properties.ReadOnlyProperty
import kotlin.test.assertEquals
import kotlin.test.assertTrue
import com.najudoryeong.mineme.feature.home.R as FeatureHomeR
import com.najudoryeong.mineme.feature.story.R as FeatureStoryR
import com.najudoryeong.mineme.feature.settings.R as FeatureSettingsR
import com.najudoryeong.mineme.feature.story.R as FeatureStoryR

@HiltAndroidTest
class NavigationTest {
Expand All @@ -48,18 +50,14 @@ class NavigationTest {
@get:Rule(order = 2)
val composeTestRule = createAndroidComposeRule<MainActivity>()



private fun AndroidComposeTestRule<*, *>.stringResource(@StringRes resId: Int) =
ReadOnlyProperty<Any?, String> { _, _ -> activity.getString(resId) }


private val navigateUp by composeTestRule.stringResource(FeatureHomeR.string.navigate_up)
private val home by composeTestRule.stringResource(FeatureHomeR.string.home)
private val story by composeTestRule.stringResource(FeatureStoryR.string.story)
private val settings by composeTestRule.stringResource(FeatureSettingsR.string.settings)


@Before
fun setup() {
hiltRule.inject()
Expand All @@ -76,7 +74,6 @@ class NavigationTest {
}
}


@Test
fun topLevelDestinations_doNotShowUpArrow() {
composeTestRule.apply {
Expand All @@ -95,15 +92,13 @@ class NavigationTest {
@Test(expected = NoActivityResumedException::class)
fun homeDestination_back_quitsApp() {
composeTestRule.apply {

onNodeWithText(settings).performClick()
onNodeWithText(home).performClick()

Espresso.pressBack()
}
}


// 다른 topDestination 에서 back homeDestinatnion 으로 가는지 Test
@Test
fun navigationBar_backFromAnyDestination_returnsToHome() {
Expand All @@ -117,5 +112,4 @@ class NavigationTest {
onNodeWithText(home).assertExists()
}
}

}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2023 KDW03
*
* 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
*
* https://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 com.najudoryeong.mineme

import androidx.compose.foundation.layout.BoxWithConstraints
Expand Down Expand Up @@ -25,7 +41,6 @@ import javax.inject.Inject
@HiltAndroidTest
class NavigationUiTest {


/**
* Manages the components' state and is used to perform injection on your test
*/
Expand Down Expand Up @@ -64,6 +79,4 @@ class NavigationUiTest {

composeTestRule.onNodeWithTag("DoBottomBar").assertIsDisplayed()
}


}
}
17 changes: 16 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2023 KDW03
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.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

Expand All @@ -9,7 +24,7 @@
android:allowBackup="true"
android:enableOnBackInvokedCallback="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:label="${appName}"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Do.Splash"
Expand Down
Loading

0 comments on commit a076f42

Please sign in to comment.