Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump org.jlleitschuh.gradle.ktlint from 11.6.1 to 12.0.2 #14870

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 1 addition & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[*.{kt,kts}]
ktlint_disabled_rules = no-wildcard-imports
# ktlint_standard_no-wildcard-imports = disabled
ktlint_standard_no-wildcard-imports = disabled
10 changes: 5 additions & 5 deletions AnkiDroid/src/androidTest/java/com/ichi2/anki/DeckPickerTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ class DeckPickerTest : InstrumentedTest() {
onView(withId(R.id.files)).perform(
RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>(
hasDescendant(withText("TestDeck$testString")),
clickChildViewWithId(R.id.counts_layout)
)
clickChildViewWithId(R.id.counts_layout),
),
)

// without this sleep, the study options fragment sometimes loses the "load and become active" race vs the assertion below.
Expand All @@ -77,7 +77,7 @@ class DeckPickerTest : InstrumentedTest() {
// Check if currently open Activity is StudyOptionsActivity
assertThat(
activityInstance,
instanceOf(StudyOptionsActivity::class.java)
instanceOf(StudyOptionsActivity::class.java),
)
}

Expand Down Expand Up @@ -108,8 +108,8 @@ class DeckPickerTest : InstrumentedTest() {
onView(withId(R.id.files)).perform(
RecyclerViewActions.actionOnItem<RecyclerView.ViewHolder>(
hasDescendant(withText("TestDeck$testString")),
clickChildViewWithId(R.id.counts_layout)
)
clickChildViewWithId(R.id.counts_layout),
),
)

// Create a card belonging to the new deck, using Basic type (guaranteed to exist)
Expand Down
22 changes: 12 additions & 10 deletions AnkiDroid/src/androidTest/java/com/ichi2/anki/FieldEditLineTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ import java.util.concurrent.atomic.AtomicReference
class FieldEditLineTest : NoteEditorTest() {
@Test
fun testSetters() {
val line = fieldEditLine().apply {
setContent("Hello", true)
name = "Name"
setOrd(5)
}
val line =
fieldEditLine().apply {
setContent("Hello", true)
name = "Name"
setOrd(5)
}
val text = line.editText
assertThat(text.ord, equalTo(5))
assertThat(text.text.toString(), equalTo("Hello"))
Expand All @@ -39,11 +40,12 @@ class FieldEditLineTest : NoteEditorTest() {

@Test
fun testSaveRestore() {
val toSave = fieldEditLine().apply {
setContent("Hello", true)
name = "Name"
setOrd(5)
}
val toSave =
fieldEditLine().apply {
setContent("Hello", true)
name = "Name"
setOrd(5)
}
val b = toSave.onSaveInstanceState()

val restored = fieldEditLine()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class NoteEditorTabOrderTest : NoteEditorTest() {

java.lang.AssertionError:

Expected: is "a""""
Expected: is "a"""",
)
@Throws(Throwable::class)
fun testTabOrder() {
Expand All @@ -66,7 +66,10 @@ class NoteEditorTabOrderTest : NoteEditorTest() {
}
}

private fun sendKeyDownUp(activity: Activity, keyCode: Int) {
private fun sendKeyDownUp(
activity: Activity,
keyCode: Int,
) {
val focusedView = activity.currentFocus
if (focusedView != null) {
val inputConnection = BaseInputConnection(focusedView, true)
Expand All @@ -78,7 +81,7 @@ class NoteEditorTabOrderTest : NoteEditorTest() {
@Throws(Throwable::class)
private fun onActivity(
scenario: ActivityScenario<NoteEditor>,
noteEditorActivityAction: ActivityAction<NoteEditor>
noteEditorActivityAction: ActivityAction<NoteEditor>,
) {
val wrapped = AtomicReference<Throwable?>(null)
scenario.onActivity { a: NoteEditor ->
Expand Down
15 changes: 7 additions & 8 deletions AnkiDroid/src/androidTest/java/com/ichi2/anki/NoteEditorTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ abstract class NoteEditorTest protected constructor() {
var runtimePermissionRule: TestRule? = GrantStoragePermission.instance

@get:Rule
var activityRule: ActivityScenarioRule<NoteEditor>? = ActivityScenarioRule(
noteEditorIntent
)
var activityRule: ActivityScenarioRule<NoteEditor>? =
ActivityScenarioRule(
noteEditorIntent,
)

private val noteEditorIntent: Intent
get() {
Expand All @@ -53,20 +54,18 @@ abstract class NoteEditorTest protected constructor() {
"Test fails on Travis API $invalid",
Build.VERSION.SDK_INT,
not(
equalTo(invalid)
)
equalTo(invalid),
),
)
}
}

private val invalidSdksImpl: List<Int>
get() {
// TODO: Look into these assumptions and see if they can be diagnosed - both work on my emulators.
// If we fix them, we might be able to use instrumentation.sendKeyDownUpSync
/*
java.lang.AssertionError: Activity never becomes requested state "[DESTROYED]" (last lifecycle transition = "PAUSED")
at androidx.test.core.app.ActivityScenario.waitForActivityToBecomeAnyOf(ActivityScenario.java:301)
*/
*/
val invalid = Build.VERSION_CODES.N_MR1
val integers = ArrayList(listOf(invalid))
integers.addAll(invalidSdks!!)
Expand Down
26 changes: 15 additions & 11 deletions AnkiDroid/src/androidTest/java/com/ichi2/anki/PagesActivityTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,17 @@ class PagesActivityTest : InstrumentedTest() {
@JvmStatic // required for initParameters
fun initParameters(): Collection<Array<out Any>> {
/** See [PageFragment] */
val intents = listOf<Pair<PagesActivityTest.(Context) -> Intent, String>>(
Pair(PagesActivityTest::getStatistics, "Statistics"),
Pair(PagesActivityTest::getCardInfo, "CardInfo"),
Pair(PagesActivityTest::getCongratsPage, "CongratsPage"),
Pair(PagesActivityTest::getDeckOptions, "DeckOptions"),
// the following need a file path
Pair(PagesActivityTest::needsPath, "AnkiPackageImporterFragment"),
Pair(PagesActivityTest::needsPath, "CsvImporter"),
Pair(PagesActivityTest::needsPath, "ImageOcclusion")
)
val intents =
listOf<Pair<PagesActivityTest.(Context) -> Intent, String>>(
Pair(PagesActivityTest::getStatistics, "Statistics"),
Pair(PagesActivityTest::getCardInfo, "CardInfo"),
Pair(PagesActivityTest::getCongratsPage, "CongratsPage"),
Pair(PagesActivityTest::getDeckOptions, "DeckOptions"),
// the following need a file path
Pair(PagesActivityTest::needsPath, "AnkiPackageImporterFragment"),
Pair(PagesActivityTest::needsPath, "CsvImporter"),
Pair(PagesActivityTest::needsPath, "ImageOcclusion"),
)

return intents.map { arrayOf(it.first, it.second) }
}
Expand All @@ -101,11 +102,14 @@ fun PagesActivityTest.getCongratsPage(context: Context): Intent {
CardInfoDestination(card.id).toIntent(context)
}
}

fun PagesActivityTest.getDeckOptions(context: Context): Intent {
return DeckOptions.getIntent(context, col.decks.allNamesAndIds().first().id)
}

fun PagesActivityTest.needsPath(@Suppress("UNUSED_PARAMETER") context: Context): Intent {
fun PagesActivityTest.needsPath(
@Suppress("UNUSED_PARAMETER") context: Context,
): Intent {
assumeThat("not implemented: path needed", false, equalTo(true))
TODO()
}
Loading
Loading