From 5b0ae77be49422f63cb54a9c74f4a1081272fd33 Mon Sep 17 00:00:00 2001 From: Brayan Oliveira <69634269+brayandso@users.noreply.github.com> Date: Tue, 26 Nov 2024 06:41:22 -0300 Subject: [PATCH] test: all preferences fragments are TitleProvider --- .../com/ichi2/anki/preferences/PreferencesTest.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/AnkiDroid/src/test/java/com/ichi2/anki/preferences/PreferencesTest.kt b/AnkiDroid/src/test/java/com/ichi2/anki/preferences/PreferencesTest.kt index f146a6a4662a..c27a41dd32f5 100644 --- a/AnkiDroid/src/test/java/com/ichi2/anki/preferences/PreferencesTest.kt +++ b/AnkiDroid/src/test/java/com/ichi2/anki/preferences/PreferencesTest.kt @@ -31,6 +31,7 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.robolectric.annotation.Config +import kotlin.reflect.jvm.jvmName @RunWith(AndroidJUnit4::class) class PreferencesTest : RobolectricTest() { @@ -83,6 +84,20 @@ class PreferencesTest : RobolectricTest() { } } + @Test + fun `All preferences fragments are TitleProvider`() { + val fragments = PreferenceTestUtils.getAllPreferencesFragments(targetContext) + .filter { it !is ReviewerOptionsFragment } // WIP dev options + + fragments.forEach { fragment -> + assertThat( + "${fragment::class.jvmName} should implement TitleProvider", + fragment is TitleProvider, + equalTo(true) + ) + } + } + @Test @Config(qualifiers = "ar") fun buildHeaderSummary_RTL_Test() {