优化
This commit is contained in:
@@ -139,6 +139,7 @@ dependencies {
|
|||||||
//coreLibraryDesugaring('com.android.tools:desugar_jdk_libs_nio:2.0.2')
|
//coreLibraryDesugaring('com.android.tools:desugar_jdk_libs_nio:2.0.2')
|
||||||
testImplementation('junit:junit:4.13.2')
|
testImplementation('junit:junit:4.13.2')
|
||||||
androidTestImplementation('androidx.test:runner:1.5.2')
|
androidTestImplementation('androidx.test:runner:1.5.2')
|
||||||
|
androidTestImplementation('androidx.test.ext:junit:1.1.3')
|
||||||
androidTestImplementation('androidx.test.espresso:espresso-core:3.5.1')
|
androidTestImplementation('androidx.test.espresso:espresso-core:3.5.1')
|
||||||
//kotlin
|
//kotlin
|
||||||
//noinspection GradleDependency,DifferentStdlibGradleVersion
|
//noinspection GradleDependency,DifferentStdlibGradleVersion
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package io.legado.app
|
package io.legado.app
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.test.InstrumentationRegistry
|
import androidx.test.core.app.ApplicationProvider
|
||||||
import androidx.test.runner.AndroidJUnit4
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
|
|
||||||
@@ -17,10 +18,17 @@ class ExampleInstrumentedTest {
|
|||||||
@Test
|
@Test
|
||||||
fun testContentProvider() {
|
fun testContentProvider() {
|
||||||
// Context of the app under test.
|
// Context of the app under test.
|
||||||
val appContext = InstrumentationRegistry.getTargetContext()
|
val appContext = ApplicationProvider.getApplicationContext<Context>()
|
||||||
Log.d("test",
|
Log.d(
|
||||||
appContext.contentResolver.query(Uri.parse("content://io.legado.app.api.ReaderProvider/sources/query"),null,null,null,null)
|
"test",
|
||||||
!!.getString(0)
|
appContext.contentResolver.query(
|
||||||
|
Uri.parse("content://io.legado.app.api.ReaderProvider/sources/query"),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
)
|
||||||
|
!!.getString(0)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import androidx.room.Room
|
|||||||
import androidx.room.migration.Migration
|
import androidx.room.migration.Migration
|
||||||
import androidx.room.testing.MigrationTestHelper
|
import androidx.room.testing.MigrationTestHelper
|
||||||
import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory
|
import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
import androidx.test.platform.app.InstrumentationRegistry
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
import androidx.test.runner.AndroidJUnit4
|
|
||||||
import io.legado.app.data.AppDatabase
|
import io.legado.app.data.AppDatabase
|
||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@@ -14,6 +14,7 @@ import java.io.IOException
|
|||||||
|
|
||||||
@RunWith(AndroidJUnit4::class)
|
@RunWith(AndroidJUnit4::class)
|
||||||
class MigrationTest {
|
class MigrationTest {
|
||||||
|
|
||||||
private val TEST_DB = "migration-test"
|
private val TEST_DB = "migration-test"
|
||||||
|
|
||||||
private val ALL_MIGRATIONS = arrayOf<Migration>(
|
private val ALL_MIGRATIONS = arrayOf<Migration>(
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ android {
|
|||||||
minSdk 21
|
minSdk 21
|
||||||
targetSdk 33
|
targetSdk 33
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
||||||
consumerProguardFiles "consumer-rules.pro"
|
consumerProguardFiles "consumer-rules.pro"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user