fix tests after icon changes
This commit is contained in:
parent
941d8a0b8b
commit
7b5d7f8fed
@ -169,7 +169,8 @@ dependencies {
|
|||||||
testImplementation 'org.robolectric:robolectric:3.8'
|
testImplementation 'org.robolectric:robolectric:3.8'
|
||||||
testImplementation "com.android.support.test:monitor:1.0.2"
|
testImplementation "com.android.support.test:monitor:1.0.2"
|
||||||
testImplementation 'org.bouncycastle:bcprov-jdk15on:1.60'
|
testImplementation 'org.bouncycastle:bcprov-jdk15on:1.60'
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.13'
|
||||||
|
testImplementation 'org.hamcrest:hamcrest:2.2'
|
||||||
testImplementation 'org.mockito:mockito-core:2.7.22'
|
testImplementation 'org.mockito:mockito-core:2.7.22'
|
||||||
|
|
||||||
androidTestImplementation 'com.android.support:support-annotations:27.1.1'
|
androidTestImplementation 'com.android.support:support-annotations:27.1.1'
|
||||||
|
@ -118,6 +118,7 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
|
|||||||
public String name = "Unknown";
|
public String name = "Unknown";
|
||||||
|
|
||||||
public String summary = "Unknown application";
|
public String summary = "Unknown application";
|
||||||
|
@JsonProperty("icon")
|
||||||
public String iconFromApk;
|
public String iconFromApk;
|
||||||
|
|
||||||
public String description;
|
public String description;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.fdroid.fdroid.updater;
|
package org.fdroid.fdroid.updater;
|
||||||
|
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
|
|
||||||
import org.fdroid.fdroid.BuildConfig;
|
import org.fdroid.fdroid.BuildConfig;
|
||||||
import org.fdroid.fdroid.IndexUpdater;
|
import org.fdroid.fdroid.IndexUpdater;
|
||||||
import org.fdroid.fdroid.data.App;
|
import org.fdroid.fdroid.data.App;
|
||||||
@ -14,7 +15,8 @@ import org.junit.runner.RunWith;
|
|||||||
import org.robolectric.RobolectricTestRunner;
|
import org.robolectric.RobolectricTestRunner;
|
||||||
import org.robolectric.annotation.Config;
|
import org.robolectric.annotation.Config;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
|
import org.hamcrest.text.MatchesPattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether app icons are loaded from the correct repository. The repository with the
|
* Check whether app icons are loaded from the correct repository. The repository with the
|
||||||
@ -42,7 +44,7 @@ public class AppIconsTest extends MultiIndexUpdaterTest {
|
|||||||
updateMain();
|
updateMain();
|
||||||
updateArchive();
|
updateArchive();
|
||||||
|
|
||||||
assertIconUrl("https://f-droid.org/repo/icons/org.adaway.54.png");
|
assertIconUrl("^https://f-droid.org/repo/icons-[0-9]{3}/org.adaway.54.png$");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -53,7 +55,7 @@ public class AppIconsTest extends MultiIndexUpdaterTest {
|
|||||||
updateMain();
|
updateMain();
|
||||||
updateArchive();
|
updateArchive();
|
||||||
|
|
||||||
assertIconUrl("https://f-droid.org/archive/icons/org.adaway.54.png");
|
assertIconUrl("^https://f-droid.org/archive/icons-[0-9]{3}/org.adaway.54.png$");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setRepoPriority(String repoUri, int priority) {
|
private void setRepoPriority(String repoUri, int priority) {
|
||||||
@ -66,9 +68,10 @@ public class AppIconsTest extends MultiIndexUpdaterTest {
|
|||||||
|
|
||||||
private void assertIconUrl(String expectedUrl) {
|
private void assertIconUrl(String expectedUrl) {
|
||||||
App app = AppProvider.Helper.findHighestPriorityMetadata(context.getContentResolver(),
|
App app = AppProvider.Helper.findHighestPriorityMetadata(context.getContentResolver(),
|
||||||
"org.adaway", new String[]{Schema.AppMetadataTable.Cols.ICON_URL});
|
"org.adaway", new String[]{
|
||||||
|
Schema.AppMetadataTable.Cols.ICON_URL,
|
||||||
assertEquals(app.getIconUrl(context), expectedUrl);
|
Schema.AppMetadataTable.Cols.ICON,
|
||||||
|
Schema.AppMetadataTable.Cols.REPO_ID});
|
||||||
|
assertThat(app.getIconUrl(context), MatchesPattern.matchesPattern(expectedUrl));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ public class IndexV1UpdaterTest extends FDroidProviderTest {
|
|||||||
"donate",
|
"donate",
|
||||||
"featureGraphic",
|
"featureGraphic",
|
||||||
"flattrID",
|
"flattrID",
|
||||||
"icon",
|
"iconFromApk",
|
||||||
"iconUrl",
|
"iconUrl",
|
||||||
"issueTracker",
|
"issueTracker",
|
||||||
"lastUpdated",
|
"lastUpdated",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user