File tree Expand file tree Collapse file tree 3 files changed +26
-7
lines changed
AnkiDroid/src/test/java/com/ichi2 Expand file tree Collapse file tree 3 files changed +26
-7
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ import com.ichi2.testutils.BackupManagerTestUtilities
3636import com.ichi2.testutils.DbUtils
3737import com.ichi2.testutils.common.Flaky
3838import com.ichi2.testutils.common.OS
39+ import com.ichi2.testutils.ext.menu
3940import com.ichi2.testutils.grantWritePermissions
4041import com.ichi2.testutils.revokeWritePermissions
4142import com.ichi2.utils.ResourceLoader
Original file line number Diff line number Diff line change 1717package com.ichi2.testutils
1818
1919import android.annotation.SuppressLint
20- import android.view.Menu
2120import androidx.appcompat.app.AppCompatDelegate
22- import androidx.appcompat.widget.Toolbar
2321import anki.collection.OpChanges
24- import com.ichi2.anki.AnkiActivity
2522import com.ichi2.anki.CollectionManager
26- import com.ichi2.anki.R
2723import com.ichi2.anki.ioDispatcher
2824import com.ichi2.anki.isCollectionEmpty
2925import com.ichi2.anki.libanki.Card
@@ -49,7 +45,6 @@ import net.ankiweb.rsdroid.exceptions.BackendDeckIsFilteredException
4945import timber.log.Timber
5046import kotlin.coroutines.CoroutineContext
5147import kotlin.coroutines.EmptyCoroutineContext
52- import kotlin.test.assertNotNull
5348import kotlin.time.Duration.Companion.milliseconds
5449
5550/* *
@@ -336,8 +331,6 @@ interface TestClass {
336331 col.updateNote(this )
337332 }
338333
339- fun AnkiActivity.menu (): Menu = assertNotNull(findViewById<Toolbar >(R .id.toolbar)?.menu)
340-
341334 /* * * A wrapper around the standard [kotlinx.coroutines.test.runTest] that
342335 * takes care of updating the dispatcher used by CollectionManager as well.
343336 * * An argument could be made for using [StandardTestDispatcher] and
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2025 David Allison <davidallisongithub@gmail.com>
3+ *
4+ * This program is free software; you can redistribute it and/or modify it under
5+ * the terms of the GNU General Public License as published by the Free Software
6+ * Foundation; either version 3 of the License, or (at your option) any later
7+ * version.
8+ *
9+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY
10+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License along with
14+ * this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+ package com.ichi2.testutils.ext
18+
19+ import android.view.Menu
20+ import androidx.appcompat.widget.Toolbar
21+ import com.ichi2.anki.AnkiActivity
22+ import com.ichi2.anki.R
23+ import kotlin.test.assertNotNull
24+
25+ fun AnkiActivity.menu (): Menu = assertNotNull(findViewById<Toolbar >(R .id.toolbar)?.menu)
You can’t perform that action at this time.
0 commit comments