Fix ktlint

This commit is contained in:
Lucas Lima 2020-12-31 15:13:17 -03:00 committed by Lucas Nunes
parent 748ea2ba1e
commit 8791fa0415
12 changed files with 22 additions and 40 deletions

View file

@ -23,7 +23,7 @@ import org.koin.androidx.viewmodel.ext.android.viewModel
class StatsActivity : ThematicActivity(R.layout.activity_stats) {
private val statsViewModel by viewModel<StatsViewModel>()
private val instantAppManager: IInstantAppManager by inject()
private val themeRepository: dev.lucasnlm.antimine.ui.repository.IThemeRepository by inject()
private val themeRepository: IThemeRepository by inject()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

View file

@ -26,7 +26,7 @@ class TutorialViewModel(
savesRepository: ISavesRepository,
statsRepository: IStatsRepository,
dimensionRepository: IDimensionRepository,
themeRepository: dev.lucasnlm.antimine.ui.repository.IThemeRepository,
themeRepository: IThemeRepository,
soundManager: ISoundManager,
minefieldRepository: IMinefieldRepository,
analyticsManager: IAnalyticsManager,

View file

@ -34,5 +34,5 @@ val TestCommonModule = module {
override fun reset(): AppTheme = LightTheme
}
} bind dev.lucasnlm.antimine.ui.repository.IThemeRepository::class
} bind IThemeRepository::class
}

View file

@ -47,11 +47,7 @@ class StatsViewModelTest : IntentViewModelTest() {
super.setup()
every { prefsRepository.getStatsBase() } returns 0
every { prefsRepository.isPremiumEnabled() } returns false
every { minefieldRepository.fromDifficulty(any(), any(), any()) } returns Minefield(
6,
12,
9
)
every { minefieldRepository.fromDifficulty(any(), any(), any()) } returns Minefield(6, 12, 9)
}
@Test

View file

@ -129,7 +129,7 @@ class ThemeViewModelTest : IntentViewModelTest() {
@Test
fun testInitialValue() {
val themeRepository = mockk<dev.lucasnlm.antimine.ui.repository.IThemeRepository> {
val themeRepository = mockk<IThemeRepository> {
every { getAllThemes() } returns allThemes
every { getTheme() } returns gardenTheme
}
@ -146,7 +146,7 @@ class ThemeViewModelTest : IntentViewModelTest() {
@Test
fun testChangeValue() {
val themeRepository = mockk<dev.lucasnlm.antimine.ui.repository.IThemeRepository> {
val themeRepository = mockk<IThemeRepository> {
every { getAllThemes() } returns allThemes
every { getTheme() } returns gardenTheme
every { setTheme(any()) } returns Unit
@ -175,7 +175,7 @@ class ThemeViewModelTest : IntentViewModelTest() {
@Test
fun testChangeValueWithoutExtras() {
val themeRepository = mockk<dev.lucasnlm.antimine.ui.repository.IThemeRepository> {
val themeRepository = mockk<IThemeRepository> {
every { getAllThemes() } returns allThemes
every { getTheme() } returns gardenTheme
every { setTheme(any()) } returns Unit

View file

@ -7,7 +7,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:4.0.2'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10'
if (System.getenv('IS_GOOGLE_BUILD')) {
classpath 'com.google.gms:google-services:4.3.4'

View file

@ -14,11 +14,7 @@ class MinefieldConverter {
@TypeConverter
fun toMinefield(jsonInput: String): Minefield =
jsonAdapter.fromJson(jsonInput) ?: Minefield(
9,
9,
9
)
jsonAdapter.fromJson(jsonInput) ?: Minefield(9, 9, 9)
@TypeConverter
fun toJsonString(field: Minefield): String = jsonAdapter.toJson(field)

View file

@ -22,7 +22,7 @@ val CommonModule = module {
single {
PreferencesRepository(
get(),
ViewConfiguration.getLongPressTimeout()
ViewConfiguration.getLongPressTimeout(),
)
} bind IPreferencesRepository::class

View file

@ -11,11 +11,7 @@ class FlagAssistantTest {
fun testRunAssistant() = runBlockingTest {
repeat(20) { takeMines ->
val creator = MinefieldCreator(
Minefield(
8,
8,
25
),
Minefield(8, 8, 25),
Random(200)
)
val map = creator.create(50, false).toMutableList()
@ -51,11 +47,7 @@ class FlagAssistantTest {
repeat(20) { takeMines ->
val seed = 10 * takeMines
val creator = MinefieldCreator(
Minefield(
8,
8,
25
),
Minefield(8, 8, 25),
Random(seed)
)
val map = creator.create(50, false).toMutableList()

View file

@ -1,5 +1,6 @@
package dev.lucasnlm.antimine.core.preferences
import dev.lucasnlm.antimine.preferences.PreferencesRepository
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
@ -37,8 +38,7 @@ class PreferencesRepositoryTest {
@Test
fun testProgressValue() {
val preferenceManager = TestPreferenceManager()
val preferencesRepository =
dev.lucasnlm.antimine.preferences.PreferencesRepository(preferenceManager, 400)
val preferencesRepository = PreferencesRepository(preferenceManager, 400)
assertEquals(0, preferencesRepository.getProgressiveValue())
@ -64,8 +64,7 @@ class PreferencesRepositoryTest {
preferenceManager.putBoolean("preference_double_click_open", true)
assertTrue(preferenceManager.values["preference_double_click_open"] as Boolean)
val preferencesRepository =
dev.lucasnlm.antimine.preferences.PreferencesRepository(preferenceManager, 400)
PreferencesRepository(preferenceManager, 400)
assertTrue(preferenceManager.values["preference_double_click_open"] == null)
assertEquals(1, preferenceManager.values["preference_control_style"])
@ -78,8 +77,7 @@ class PreferencesRepositoryTest {
preferenceManager.putBoolean("preference_double_click_open", false)
assertFalse(preferenceManager.values["preference_double_click_open"] as Boolean)
val preferencesRepository =
dev.lucasnlm.antimine.preferences.PreferencesRepository(preferenceManager, 400)
PreferencesRepository(preferenceManager, 400)
assertTrue(preferenceManager.values["preference_double_click_open"] == null)
assertFalse(preferenceManager.getBoolean("preference_double_click_open", false))
@ -91,8 +89,7 @@ class PreferencesRepositoryTest {
preferenceManager.putBoolean("preference_large_area", true)
assertTrue(preferenceManager.values["preference_large_area"] as Boolean)
val preferencesRepository =
dev.lucasnlm.antimine.preferences.PreferencesRepository(preferenceManager, 400)
PreferencesRepository(preferenceManager, 400)
assertTrue(preferenceManager.values["preference_large_area"] == null)
assertEquals(63, preferenceManager.getInt("preference_area_size", -1))
@ -101,7 +98,7 @@ class PreferencesRepositoryTest {
@Test
fun testMigrationLargeAreaOff() {
val preferenceManager = TestPreferenceManager()
dev.lucasnlm.antimine.preferences.PreferencesRepository(preferenceManager, 400)
PreferencesRepository(preferenceManager, 400)
assertTrue(preferenceManager.values["preference_large_area"] == null)
assertEquals(50, preferenceManager.getInt("preference_area_size", -1))

View file

@ -1,12 +1,13 @@
package dev.lucasnlm.antimine.core.themes.repository
import dev.lucasnlm.antimine.ui.repository.Themes
import org.junit.Assert.assertEquals
import org.junit.Test
class ThemeRepositoryTest {
@Test
fun getAllThemesMustNotHaveDuplicatedIds() {
val customThemes = dev.lucasnlm.antimine.ui.repository.Themes.getAllCustom()
val customThemes = Themes.getAllCustom()
customThemes.distinctBy { it.id }.count()
assertEquals(customThemes.size, customThemes.distinctBy { it.id }.count())
}

View file

@ -54,10 +54,10 @@
<string name="you_won">You won!</string>
<string name="victories">Victories</string>
<string name="you_lost">You lost!</string>
<string name="you_finished">You have finished!</string>
<string name="you_finished">You finished!</string>
<string name="defeats">Defeats</string>
<string name="generic_game_over">Good luck on your next game.</string>
<string name="generic_win">You finished the minefield in %1$d seconds.</string>
<string name="generic_win">You found %1$d mines in %1$d seconds.</string>
<string name="fail_to_share">Failed to share</string>
<string name="version_s">Version %1$s</string>
<string name="sound_effects">Sound Effects</string>