pull/1094/head
lihenggui 1 year ago
parent ff599eac37
commit fb5bd225be

@ -35,6 +35,8 @@ abstract class AnalyticsModule {
companion object {
@Provides
@Singleton
fun provideFirebaseAnalytics(): FirebaseAnalytics { return Firebase.analytics }
fun provideFirebaseAnalytics(): FirebaseAnalytics {
return Firebase.analytics
}
}
}

@ -25,7 +25,7 @@ import kotlin.test.assertEquals
class ResultKtTest {
@Test
fun Result_catches_errors() = runTest {
fun result_catches_errors() = runTest {
flow {
emit(1)
throw Exception("Test Done")

@ -27,7 +27,7 @@ import kotlin.test.assertTrue
class IntToStringIdsMigrationTest {
@Test
fun IntToStringIdsMigration_should_migrate_topic_ids() = runTest {
fun intToStringIdsMigration_should_migrate_topic_ids() = runTest {
// Set up existing preferences with topic int ids
val preMigrationUserPreferences = userPreferences {
deprecatedIntFollowedTopicIds.addAll(listOf(1, 2, 3))
@ -56,7 +56,7 @@ class IntToStringIdsMigrationTest {
}
@Test
fun IntToStringIdsMigration_should_migrate_author_ids() = runTest {
fun intToStringIdsMigration_should_migrate_author_ids() = runTest {
// Set up existing preferences with author int ids
val preMigrationUserPreferences = userPreferences {
deprecatedIntFollowedAuthorIds.addAll(listOf(4, 5, 6))

@ -24,7 +24,7 @@ import kotlin.test.assertTrue
class ListToMapMigrationTest {
@Test
fun ListToMapMigration_should_migrate_topic_ids() = runTest {
fun listToMapMigration_should_migrate_topic_ids() = runTest {
// Set up existing preferences with topic ids
val preMigrationUserPreferences = userPreferences {
deprecatedFollowedTopicIds.addAll(listOf("1", "2", "3"))
@ -50,7 +50,7 @@ class ListToMapMigrationTest {
}
@Test
fun ListToMapMigration_should_migrate_author_ids() = runTest {
fun listToMapMigration_should_migrate_author_ids() = runTest {
// Set up existing preferences with author ids
val preMigrationUserPreferences = userPreferences {
deprecatedFollowedAuthorIds.addAll(listOf("4", "5", "6"))
@ -76,7 +76,7 @@ class ListToMapMigrationTest {
}
@Test
fun ListToMapMigration_should_migrate_bookmarks() = runTest {
fun listToMapMigration_should_migrate_bookmarks() = runTest {
// Set up existing preferences with bookmarks
val preMigrationUserPreferences = userPreferences {
deprecatedBookmarkedNewsResourceIds.addAll(listOf("7", "8", "9"))

@ -278,7 +278,7 @@ fun NiaButtonPreview() {
@ThemePreviews
@Composable
fun NiaOutlinedButtonPreview() {
NiaTheme() {
NiaTheme {
NiaBackground(modifier = Modifier.size(150.dp, 50.dp)) {
NiaOutlinedButton(onClick = {}, text = { Text("Test button") })
}

@ -251,5 +251,7 @@ private fun scrollbarThumbColor(
}
private enum class ThumbState {
Active, Inactive, Dormant
Active,
Inactive,
Dormant,
}

@ -66,7 +66,7 @@ class LoadingWheelScreenshotTests() {
fun loadingWheelAnimation() {
composeTestRule.mainClock.autoAdvance = false
composeTestRule.setContent {
NiaTheme() {
NiaTheme {
NiaLoadingWheel(contentDesc = "")
}
}

@ -47,7 +47,7 @@ class TagScreenshotTests() {
val composeTestRule = createAndroidComposeRule<ComponentActivity>()
@Test
fun Tag_multipleThemes() {
fun tag_multipleThemes() {
composeTestRule.captureMultiTheme("Tag") {
NiaTopicTag(followed = true, onClick = {}) {
Text("TOPIC")

@ -17,5 +17,7 @@
package com.google.samples.apps.nowinandroid.core.model.data
enum class DarkThemeConfig {
FOLLOW_SYSTEM, LIGHT, DARK
FOLLOW_SYSTEM,
LIGHT,
DARK,
}

@ -17,5 +17,6 @@
package com.google.samples.apps.nowinandroid.core.model.data
enum class ThemeBrand {
DEFAULT, ANDROID
DEFAULT,
ANDROID,
}

@ -45,9 +45,10 @@ class FakeNiaNetworkDataSourceTest {
}
@Test
fun testDeserializationOfTopics() = runTest(testDispatcher) {
fun testDeserializationOfTopics() =
@Suppress("ktlint:standard:max-line-length")
runTest(testDispatcher) {
assertEquals(
/* ktlint-disable max-line-length */
NetworkTopic(
id = "1",
name = "Headlines",
@ -56,15 +57,15 @@ class FakeNiaNetworkDataSourceTest {
url = "",
imageUrl = "https://firebasestorage.googleapis.com/v0/b/now-in-android.appspot.com/o/img%2Fic_topic_Headlines.svg?alt=media&token=506faab0-617a-4668-9e63-4a2fb996603f",
),
/* ktlint-enable max-line-length */
subject.getTopics().first(),
)
}
@Test
fun testDeserializationOfNewsResources() = runTest(testDispatcher) {
fun testDeserializationOfNewsResources() =
@Suppress("ktlint:standard:max-line-length")
runTest(testDispatcher) {
assertEquals(
/* ktlint-disable max-line-length */
NetworkNewsResource(
id = "125",
title = "Android Basics with Compose",
@ -83,7 +84,6 @@ class FakeNiaNetworkDataSourceTest {
type = "Codelab",
topics = listOf("2", "3", "10"),
),
/* ktlint-enable max-line-length */
subject.getNewsResources().find { it.id == "125" },
)
}

@ -14,12 +14,13 @@
* limitations under the License.
*/
@file:Suppress("ktlint:standard:max-line-length")
package com.google.samples.apps.nowinandroid.core.testing.data
import com.google.samples.apps.nowinandroid.core.model.data.FollowableTopic
import com.google.samples.apps.nowinandroid.core.model.data.Topic
/* ktlint-disable max-line-length */
val followableTopicTestData: List<FollowableTopic> = listOf(
FollowableTopic(
topic = Topic(

@ -14,12 +14,13 @@
* limitations under the License.
*/
@file:Suppress("ktlint:standard:max-line-length")
package com.google.samples.apps.nowinandroid.core.testing.data
import com.google.samples.apps.nowinandroid.core.model.data.NewsResource
import kotlinx.datetime.Instant
/* ktlint-disable max-line-length */
val newsResourcesTestData: List<NewsResource> = listOf(
NewsResource(
id = "1",

@ -14,11 +14,12 @@
* limitations under the License.
*/
@file:Suppress("ktlint:standard:max-line-length")
package com.google.samples.apps.nowinandroid.core.testing.data
import com.google.samples.apps.nowinandroid.core.model.data.Topic
/* ktlint-disable max-line-length */
val topicsTestData: List<Topic> = listOf(
Topic(
id = "2",

@ -14,6 +14,8 @@
* limitations under the License.
*/
@file:Suppress("ktlint:standard:max-line-length")
package com.google.samples.apps.nowinandroid.core.testing.data
import com.google.samples.apps.nowinandroid.core.model.data.DarkThemeConfig
@ -26,7 +28,6 @@ import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.TimeZone
import kotlinx.datetime.toInstant
/* ktlint-disable max-line-length */
val userNewsResourcesTestData: List<UserNewsResource> = UserData(
bookmarkedNewsResources = setOf("1", "4"),
viewedNewsResources = setOf("1", "2", "4"),

@ -14,13 +14,14 @@
* limitations under the License.
*/
@file:Suppress("ktlint:standard:max-line-length")
package com.google.samples.apps.nowinandroid.core.ui
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import com.google.samples.apps.nowinandroid.core.model.data.FollowableTopic
import com.google.samples.apps.nowinandroid.core.model.data.Topic
/* ktlint-disable max-line-length */
/**
* This [PreviewParameterProvider](https://developer.android.com/reference/kotlin/androidx/compose/ui/tooling/preview/PreviewParameterProvider)
* provides list of [FollowableTopic] for Composable previews.

@ -14,6 +14,8 @@
* limitations under the License.
*/
@file:Suppress("ktlint:standard:max-line-length")
package com.google.samples.apps.nowinandroid.core.ui
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
@ -29,7 +31,6 @@ import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.TimeZone
import kotlinx.datetime.toInstant
/* ktlint-disable max-line-length */
/**
* This [PreviewParameterProvider](https://developer.android.com/reference/kotlin/androidx/compose/ui/tooling/preview/PreviewParameterProvider)
* provides list of [UserNewsResource] for Composable previews.

@ -14,6 +14,8 @@
* limitations under the License.
*/
@file:Suppress("ktlint:standard:max-line-length")
package com.google.samples.apps.nowinandroid.feature.search
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
@ -21,7 +23,6 @@ import com.google.samples.apps.nowinandroid.core.model.data.FollowableTopic
import com.google.samples.apps.nowinandroid.core.ui.PreviewParameterData.newsResources
import com.google.samples.apps.nowinandroid.core.ui.PreviewParameterData.topics
/* ktlint-disable max-line-length */
/**
* This [PreviewParameterProvider](https://developer.android.com/reference/kotlin/androidx/compose/ui/tooling/preview/PreviewParameterProvider)
* provides list of [SearchResultUiState] for Composable previews.

@ -14,6 +14,8 @@
* limitations under the License.
*/
@file:Suppress("ktlint:standard:max-line-length")
package com.google.samples.apps.nowinandroid.feature.settings
import android.content.Intent
@ -316,7 +318,6 @@ private fun PreviewSettingsDialogLoading() {
}
}
/* ktlint-disable max-line-length */
private const val PRIVACY_POLICY_URL = "https://policies.google.com/privacy"
private const val BRAND_GUIDELINES_URL = "https://developer.android.com/distribute/marketing-tools/brand-guidelines"
private const val FEEDBACK_URL = "https://goo.gle/nia-app-feedback"

Loading…
Cancel
Save