Merge 4.0-release into master (#5028)

* Fix string for custom selector

* Fix bug #4950 back arrow still present on top-level activity (#4952)

* Fix bug #4949 by correctly setting previous db version number (#4956)

* Fix bug #4949 by correctly setting previous db version number

* Fix failing tests

* Fix bug #4959 by correctly setting previous db version number and updating the current db version (#4960)

* Fix bug #4957 (#4961)

* Update library to new version that handles older Java VMs

Fixes #4972 I believe.

* Versioning for v4.0.0

* Changelog for v4.0.0

* Fix bug #4984 Added queries for package name for Android API 30+ (#4987)

* Update mapbox sdk version (#4989)

* Versioning for v4.0.1

* Changelog for v4.0.1

* Remove network type information from NetworkUtils (#4996)

* Remove network type information from NetworkUtils

* Ignore dependent tests

* Fix #4992 invert the equals condition to be null safe (#4995)

* Fix java.lang.NullPointerException for username in ContributionBoundaryCallback (#5003)

* Fix failing tests for PR #5003 (#5004)

* Fix java.lang.NullPointerException for username in ContributionBoundaryCallback

* Fix failing tests

* Update Room DB Version (#5011)

* Fix #5001 (#5010)

* Fix DB update issue (#5016)

* [WIP] Fix both timezone problem and saved date problem (#5019)

* Fix both timezone problem and saved date problem

* Fixaccidental test code and add comments

* Add issue link to the comments

* Fix format issue and null checks

* Versioning for v4.0.2

* Changelog for v4.0.2

* Add "Report Violation" menu option (#5025)

* Add "Report Violation" menu option

* Update email template

* Update email address

* Fixed typo

Co-authored-by: Josephine Lim <josephinelim86@gmail.com>

* Versioning for v4.0.3

* Changelog for v4.0.3

Co-authored-by: Josephine Lim <josephinelim86@gmail.com>
Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>
Co-authored-by: neslihanturan <tur.neslihan@gmail.com>
This commit is contained in:
Madhur Gupta 2022-08-08 11:21:07 +05:30 committed by GitHub
parent 1de8968fa8
commit 3cdfdcffe1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 406 additions and 72 deletions

View file

@ -271,9 +271,84 @@ class BookmarkItemsDaoTest {
@Test
fun migrateTableVersionFrom_v7_to_v8() {
onUpdate(database, 7, 8)
// Table didn't change in version 8
verifyZeroInteractions(database)
}
@Test
fun migrateTableVersionFrom_v8_to_v9() {
onUpdate(database, 8, 9)
// Table didn't change in version 9
verifyZeroInteractions(database)
}
@Test
fun migrateTableVersionFrom_v9_to_v10() {
onUpdate(database, 9, 10)
// Table didn't change in version 10
verifyZeroInteractions(database)
}
@Test
fun migrateTableVersionFrom_v10_to_v11() {
onUpdate(database, 10, 11)
// Table didn't change in version 11
verifyZeroInteractions(database)
}
@Test
fun migrateTableVersionFrom_v11_to_v12() {
onUpdate(database, 11, 12)
// Table didn't change in version 12
verifyZeroInteractions(database)
}
@Test
fun migrateTableVersionFrom_v12_to_v13() {
onUpdate(database, 12, 13)
// Table didn't change in version 13
verifyZeroInteractions(database)
}
@Test
fun migrateTableVersionFrom_v13_to_v14() {
onUpdate(database, 13, 14)
// Table didn't change in version 14
verifyZeroInteractions(database)
}
@Test
fun migrateTableVersionFrom_v14_to_v15() {
onUpdate(database, 14, 15)
// Table didn't change in version 15
verifyZeroInteractions(database)
}
@Test
fun migrateTableVersionFrom_v15_to_v16() {
onUpdate(database, 15, 16)
// Table didn't change in version 16
verifyZeroInteractions(database)
}
@Test
fun migrateTableVersionFrom_v16_to_v17() {
onUpdate(database, 16, 17)
// Table didn't change in version 17
verifyZeroInteractions(database)
}
@Test
fun migrateTableVersionFrom_v18_to_v19() {
onUpdate(database, 18, 19)
verify(database).execSQL(CREATE_TABLE_STATEMENT)
}
@Test
fun migrateTableVersionFrom_v19_to_v19() {
onUpdate(database, 19, 19)
verifyZeroInteractions(database)
}
private fun createCursor(rowCount: Int) = MatrixCursor(columns, rowCount).apply {

View file

@ -18,6 +18,7 @@ import org.mockito.ArgumentMatchers.anyString
import org.mockito.Mock
import org.mockito.Mockito.mock
import org.mockito.MockitoAnnotations
import java.lang.reflect.Method
/**
* The unit test class for ContributionBoundaryCallbackTest
@ -95,7 +96,11 @@ class ContributionBoundaryCallbackTest {
whenever(mediaClient.getMediaListForUser(anyString())).thenReturn(
Single.just(listOf(media()))
)
contributionBoundaryCallback.fetchContributions()
val method: Method = ContributionBoundaryCallback::class.java.getDeclaredMethod(
"fetchContributions"
)
method.isAccessible = true
method.invoke(contributionBoundaryCallback)
verify(repository).save(anyList());
verify(mediaClient).getMediaListForUser(anyString());
}
@ -104,7 +109,11 @@ class ContributionBoundaryCallbackTest {
fun testFetchContributionsFailed() {
whenever(sessionManager.userName).thenReturn("Test")
whenever(mediaClient.getMediaListForUser(anyString())).thenReturn(Single.error(Exception("Error")))
contributionBoundaryCallback.fetchContributions()
val method: Method = ContributionBoundaryCallback::class.java.getDeclaredMethod(
"fetchContributions"
)
method.isAccessible = true
method.invoke(contributionBoundaryCallback)
verifyZeroInteractions(repository);
verify(mediaClient).getMediaListForUser(anyString());
}

View file

@ -177,20 +177,103 @@ class RecentLanguagesDaoUnitTest {
@Test
fun migrateTableVersionFrom_v5_to_v6() {
onUpdate(database, 5, 6)
// Table didnt exist before v7
// Table didnt exist in version 6
verifyZeroInteractions(database)
}
@Test
fun migrateTableVersionFrom_v6_to_v7() {
onUpdate(database, 6, 7)
verify(database).execSQL(CREATE_TABLE_STATEMENT)
// Table didnt exist in version 7
verifyZeroInteractions(database)
}
@Test
fun migrateTableVersionFrom_v7_to_v8() {
onUpdate(database, 7, 8)
// Table didnt change in version 8
// Table didnt exist in version 8
verifyZeroInteractions(database)
}
@Test
fun migrateTableVersionFrom_v8_to_v9() {
onUpdate(database, 8, 9)
// Table didnt exist in version 9
verifyZeroInteractions(database)
}
@Test
fun migrateTableVersionFrom_v9_to_v10() {
onUpdate(database, 9, 10)
// Table didnt exist in version 10
verifyZeroInteractions(database)
}
@Test
fun migrateTableVersionFrom_v10_to_v11() {
onUpdate(database, 10, 11)
// Table didnt exist in version 11
verifyZeroInteractions(database)
}
@Test
fun migrateTableVersionFrom_v11_to_v12() {
onUpdate(database, 11, 12)
// Table didnt exist in version 12
verifyZeroInteractions(database)
}
@Test
fun migrateTableVersionFrom_v12_to_v13() {
onUpdate(database, 12, 13)
// Table didnt exist in version 13
verifyZeroInteractions(database)
}
@Test
fun migrateTableVersionFrom_v13_to_v14() {
onUpdate(database, 13, 14)
// Table didnt exist in version 14
verifyZeroInteractions(database)
}
@Test
fun migrateTableVersionFrom_v14_to_v15() {
onUpdate(database, 14, 15)
// Table didnt exist in version 15
verifyZeroInteractions(database)
}
@Test
fun migrateTableVersionFrom_v15_to_v16() {
onUpdate(database, 15, 16)
// Table didnt exist in version 16
verifyZeroInteractions(database)
}
@Test
fun migrateTableVersionFrom_v16_to_v17() {
onUpdate(database, 16, 17)
// Table didnt exist in version 17
verifyZeroInteractions(database)
}
@Test
fun migrateTableVersionFrom_v18_to_v19() {
onUpdate(database, 18, 19)
// Table didnt exist in version 18
verifyZeroInteractions(database)
}
@Test
fun migrateTableVersionFrom_v19_to_v20() {
onUpdate(database, 19, 20)
verify(database).execSQL(CREATE_TABLE_STATEMENT)
}
@Test
fun migrateTableVersionFrom_v20_to_v20() {
onUpdate(database, 20, 20)
verifyZeroInteractions(database)
}

View file

@ -8,6 +8,7 @@ import android.telephony.TelephonyManager;
import org.jetbrains.annotations.NotNull;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import fr.free.nrw.commons.utils.model.NetworkConnectionType;
@ -97,6 +98,7 @@ public class NetworkUtilsTest {
}
@Test
@Ignore("Fix these test with telemetry permission")
public void testCellular2GNetwork() {
Context mockContext = mock(Context.class);
Application mockApplication = mock(Application.class);
@ -123,6 +125,7 @@ public class NetworkUtilsTest {
}
@Test
@Ignore("Fix these test with telemetry permission")
public void testCellular3GNetwork() {
Context mockContext = mock(Context.class);
Application mockApplication = mock(Application.class);
@ -149,6 +152,7 @@ public class NetworkUtilsTest {
}
@Test
@Ignore("Fix these test with telemetry permission")
public void testCellular4GNetwork() {
Context mockContext = mock(Context.class);
Application mockApplication = mock(Application.class);