Merge remote-tracking branch 'origin/master' into dev

This commit is contained in:
Tobias Kaminsky 2024-02-24 03:37:04 +01:00
commit 94b56d42e8
25 changed files with 124 additions and 29 deletions

View file

@ -32,7 +32,7 @@ jobs:
with:
swap-size-gb: 10
- name: Initialize CodeQL
uses: github/codeql-action/init@e2e140ad1441662206e8f97754b166877dfa1c73 # v3.24.4
uses: github/codeql-action/init@47b3d888fe66b639e431abf22ebca059152f1eea # v3.24.5
with:
languages: ${{ matrix.language }}
- name: Set up JDK 17
@ -46,4 +46,4 @@ jobs:
echo "org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > "$HOME/.gradle/gradle.properties"
./gradlew assembleDebug
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@e2e140ad1441662206e8f97754b166877dfa1c73 # v3.24.4
uses: github/codeql-action/analyze@47b3d888fe66b639e431abf22ebca059152f1eea # v3.24.5

View file

@ -37,6 +37,6 @@ jobs:
# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@e2e140ad1441662206e8f97754b166877dfa1c73 # v3.24.4
uses: github/codeql-action/upload-sarif@47b3d888fe66b639e431abf22ebca059152f1eea # v3.24.5
with:
sarif_file: results.sarif

View file

@ -8,7 +8,7 @@ permissions:
contents: read
pull-requests: write
concurrency:
concurrency:
group: screenshot-test-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
@ -73,6 +73,8 @@ jobs:
run: scripts/deleteOldComments.sh "${{ matrix.color }}-${{ matrix.scheme }}" "Screenshot" ${{github.event.number}}
- name: Run screenshot tests
env:
SHOT_TEST: "true"
uses: reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2.30.1
with:
api-level: ${{ matrix.api-level }}

View file

@ -1,6 +1,6 @@
import com.github.spotbugs.snom.SpotBugsTask
import com.github.spotbugs.snom.Confidence
import com.github.spotbugs.snom.Effort
import com.github.spotbugs.snom.SpotBugsTask
import org.gradle.internal.jvm.Jvm
buildscript {
@ -32,7 +32,12 @@ apply plugin: 'pmd'
apply from: "$rootProject.projectDir/jacoco.gradle"
apply plugin: 'com.github.spotbugs'
apply plugin: 'io.gitlab.arturbosch.detekt'
apply plugin: 'shot'
// needed to make renovate run without shot, as shot requires Android SDK
// https://github.com/pedrovgs/Shot/issues/300
if (shotTest) {
apply plugin: 'shot'
}
apply plugin: 'com.google.devtools.ksp'
@ -99,7 +104,11 @@ android {
}
// arguments to be passed to functional tests
testInstrumentationRunner "com.nextcloud.client.ScreenshotTestRunner"
if (shotTest) {
testInstrumentationRunner "com.karumi.shot.ShotTestRunner"
} else {
testInstrumentationRunner "com.nextcloud.client.TestRunner"
}
testInstrumentationRunnerArgument "TEST_SERVER_URL", "${NC_TEST_SERVER_BASEURL}"
testInstrumentationRunnerArgument "TEST_SERVER_USERNAME", "${NC_TEST_SERVER_USERNAME}"
testInstrumentationRunnerArgument "TEST_SERVER_PASSWORD", "${NC_TEST_SERVER_PASSWORD}"
@ -381,7 +390,7 @@ dependencies {
implementation "com.github.stateless4j:stateless4j:2.6.0"
// upon each update first test: new registration, receive push
gplayImplementation "com.google.firebase:firebase-messaging:23.2.1"
gplayImplementation "com.google.firebase:firebase-messaging:23.4.1"
gplayImplementation 'com.google.android.play:review-ktx:2.0.1'
implementation 'com.github.nextcloud.android-common:ui:0.15.0'
@ -431,11 +440,13 @@ detekt {
config.setFrom("detekt.yml")
}
shot {
showOnlyFailingTestsInReports = ciBuild
// CI environment renders some shadows slightly different from local VMs
// Add a 0.5% tolerance to account for that
tolerance = ciBuild ? 0.5 : 0
if (shotTest) {
shot {
showOnlyFailingTestsInReports = ciBuild
// CI environment renders some shadows slightly different from local VMs
// Add a 0.5% tolerance to account for that
tolerance = ciBuild ? 0.5 : 0
}
}
jacoco {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

View file

@ -137,7 +137,7 @@ class FileDisplayActivityIT : AbstractOnServerIT() {
.perform(NavigationViewActions.navigateTo(R.id.nav_shared))
shortSleep()
shortSleep()
screenshot(sut)
// screenshot(sut) // todo run without real server
}
@Test

View file

@ -27,11 +27,11 @@ import android.app.Application
import android.app.Instrumentation
import android.content.Context
import android.os.Build
import androidx.test.runner.AndroidJUnitRunner
import com.github.tmurakami.dexopener.DexOpener
import com.karumi.shot.ShotTestRunner
import com.nextcloud.test.TestMainApp
class ScreenshotTestRunner : ShotTestRunner() {
class TestRunner : AndroidJUnitRunner() {
@Throws(ClassNotFoundException::class, IllegalAccessException::class, InstantiationException::class)
override fun newApplication(cl: ClassLoader, className: String, context: Context): Application {
/*

View file

@ -25,6 +25,7 @@ package com.owncloud.android.ui.dialog;
import com.owncloud.android.AbstractIT;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.utils.ScreenshotTest;
import org.junit.Rule;
import org.junit.Test;
@ -41,6 +42,7 @@ public class SyncFileNotEnoughSpaceDialogFragmentTest extends AbstractIT {
false);
@Test
@ScreenshotTest
public void showNotEnoughSpaceDialogForFolder() {
FileDisplayActivity test = activityRule.launchActivity(null);
OCFile ocFile = new OCFile("/Document/");
@ -56,6 +58,7 @@ public class SyncFileNotEnoughSpaceDialogFragmentTest extends AbstractIT {
}
@Test
@ScreenshotTest
public void showNotEnoughSpaceDialogForFile() {
FileDisplayActivity test = activityRule.launchActivity(null);
OCFile ocFile = new OCFile("/Video.mp4");

View file

@ -26,6 +26,7 @@ import com.owncloud.android.AbstractIT;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.utils.MimeTypeUtil;
import com.owncloud.android.utils.ScreenshotTest;
import org.junit.Rule;
import org.junit.Test;
@ -41,7 +42,7 @@ public class PreviewTextFileFragmentTest extends AbstractIT {
false);
@Test
// @ScreenshotTest // todo run without real server
@ScreenshotTest
public void displaySimpleTextFile() throws IOException {
FileDisplayActivity sut = activityRule.launchActivity(null);
@ -59,7 +60,7 @@ public class PreviewTextFileFragmentTest extends AbstractIT {
}
@Test
// @ScreenshotTest // todo run without real server
@ScreenshotTest
public void displayJavaSnippetFile() throws IOException {
FileDisplayActivity sut = activityRule.launchActivity(null);

View file

@ -109,6 +109,7 @@ class TrashbinActivityIT : AbstractIT() {
}
@Test
@ScreenshotTest
fun normalUser() {
val sut: TrashbinActivity = activityRule.launchActivity(null)
@ -124,6 +125,7 @@ class TrashbinActivityIT : AbstractIT() {
}
@Test
@ScreenshotTest
fun differentUser() {
val temp = Account("differentUser@https://nextcloud.localhost", MainApp.getAccountType(targetContext))

View file

@ -60,7 +60,6 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.text.Editable;
import android.text.TextUtils;
import android.util.AndroidRuntimeException;
import android.view.KeyEvent;
@ -215,7 +214,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
private AccountManager mAccountMgr;
/// Server PRE-Fragment elements
private AccountSetupBinding accountSetupBinding;
private AccountSetupBinding accountSetupBinding = null;
private AccountSetupWebviewBinding accountSetupWebviewBinding;
private String mServerStatusText = EMPTY_STRING;
@ -768,13 +767,14 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
}
@SuppressFBWarnings("NP")
private void checkOcServer() {
String uri;
Editable hostUrlInput = accountSetupBinding.hostUrlInput.getText();
if (accountSetupBinding != null && hostUrlInput != null &&
!hostUrlInput.toString().isEmpty()) {
uri = hostUrlInput.toString().trim();
if (accountSetupBinding != null &&
accountSetupBinding.hostUrlInput.getText() != null &&
!accountSetupBinding.hostUrlInput.getText().toString().isEmpty()) {
uri = accountSetupBinding.hostUrlInput.getText().toString().trim();
} else {
uri = mServerInfo.mBaseUrl;
}

View file

@ -235,14 +235,19 @@ public class TrashbinListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
thumbnailView.setImageBitmap(thumbnail);
}
} else {
thumbnailView.setImageDrawable(MimeTypeUtil.getFileTypeIcon(file.getMimeType(),
file.getFileName(),
context,
viewThemeUtils));
// generate new thumbnail
if (ThumbnailsCacheManager.cancelPotentialThumbnailWork(file, thumbnailView)) {
try {
final ThumbnailsCacheManager.ThumbnailGenerationTask task =
new ThumbnailsCacheManager.ThumbnailGenerationTask(thumbnailView,
storageManager,
user,
asyncTasks);
new ThumbnailsCacheManager.ThumbnailGenerationTask(thumbnailView,
storageManager,
user,
asyncTasks);
final ThumbnailsCacheManager.AsyncThumbnailDrawable asyncDrawable =
new ThumbnailsCacheManager.AsyncThumbnailDrawable(context.getResources(),

View file

@ -15,6 +15,7 @@
<string name="action_switch_grid_view">Rasterindeling </string>
<string name="action_switch_list_view">Lijstindeling</string>
<string name="actionbar_mkdir">Nieuwe map</string>
<string name="actionbar_move_or_copy">Verplaatsen of kopiëren</string>
<string name="actionbar_open_with">Openen met</string>
<string name="actionbar_search">Zoeken</string>
<string name="actionbar_see_details">Details</string>

View file

@ -21,6 +21,7 @@ buildscript {
roomVersion = "2.6.1"
ciBuild = System.getenv("CI") == "true"
shotTest = System.getenv("SHOT_TEST") == "true"
}
}

View file

@ -3483,6 +3483,14 @@
<sha256 value="1537bebd44da2eb7e3be73fc4259e1116f2a68a5305f4fe23c6cea9a6f84f791" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.google.android.datatransport" name="transport-api" version="3.1.0">
<artifact name="transport-api-3.1.0.aar">
<sha256 value="7dafc39f0ea835473366acc346f7e67fc8443f4c645d999c3e987bcad6b88c7b" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
<artifact name="transport-api-3.1.0.pom">
<sha256 value="2560c245693d1f2d619903b6dd1b7cf9df11f774180bc3f09c21598e186f8648" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.google.android.datatransport" name="transport-backend-cct" version="3.1.8">
<artifact name="transport-backend-cct-3.1.8.aar">
<sha256 value="e17edd1ef7fd475c90baa4e39422332f27087d34bcb46cb48ce86af9a54a612e" origin="Generated by Gradle" reason="Artifact is not signed"/>
@ -3531,6 +3539,14 @@
<sha256 value="591e802e3401464ef13da013ad5be758042137f5372270e225f7d546ca9cb189" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.google.android.gms" name="play-services-cloud-messaging" version="17.1.0">
<artifact name="play-services-cloud-messaging-17.1.0.aar">
<sha256 value="f2052066c74c831ae356b374227cbb9fe9c4877eaa5a1ac91a572455a0f346a5" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
<artifact name="play-services-cloud-messaging-17.1.0.pom">
<sha256 value="adec3fb60acc63f7a95927a69961936772f5ec2cceb0f8c235767d2d8940b3e4" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.google.android.gms" name="play-services-stats" version="17.0.2">
<artifact name="play-services-stats-17.0.2.aar">
<sha256 value="dd4314a53f49a378ec146103d36232b96c75454d29526336ccbdf132941764d3" origin="Generated by Gradle" reason="Artifact is not signed"/>
@ -4019,6 +4035,11 @@
<sha256 value="0c100ffa8be7b4bf30d502cc2f54724c05bfa54dfa52efb7deeb56faab5e8522" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.google.firebase" name="firebase-annotations" version="16.1.0">
<artifact name="firebase-annotations-16.1.0.pom">
<sha256 value="6aeed1527ffb8ba1331a6e464aad8a1327250210b8d9d44bc34aa9e9db5e32b0" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.google.firebase" name="firebase-annotations" version="16.2.0">
<artifact name="firebase-annotations-16.2.0.jar">
<sha256 value="46f6d5dfdd2ccf3c40de897a14bd9779314c3319f44bfd31e7e0a20d935a5e3e" origin="Generated by Gradle" reason="Artifact is not signed"/>
@ -4035,6 +4056,22 @@
<sha256 value="e4384760257e46fc5a454f8b868cf6cdbf297958ed6f5f67acf80fddc181aba6" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.google.firebase" name="firebase-common" version="20.4.2">
<artifact name="firebase-common-20.4.2.aar">
<sha256 value="37782e3f361b6c424b5439a3f33d569433d7e266055801f51ffca0badda898da" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
<artifact name="firebase-common-20.4.2.pom">
<sha256 value="d8e2223227f267d95f5580f746ca009342e466938964c515b8d66f5da0e493b6" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.google.firebase" name="firebase-common-ktx" version="20.4.2">
<artifact name="firebase-common-ktx-20.4.2.aar">
<sha256 value="170b44690e480d1dde79a8d163586a1025ab5542ee0aac3874b76e7d1c27718f" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
<artifact name="firebase-common-ktx-20.4.2.pom">
<sha256 value="749101fe70375aefd4d87ea01255dc990d6477745ba752f18d31b960a2a3074b" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.google.firebase" name="firebase-components" version="17.1.0">
<artifact name="firebase-components-17.1.0.aar">
<sha256 value="352c71f89994cb4481daeb45ed3630bbf1789bdf1be4563988e2c18618af4f60" origin="Generated by Gradle" reason="Artifact is not signed"/>
@ -4043,6 +4080,14 @@
<sha256 value="809ab7f16d8e7210f30d388d55851104c519be0488b1c550462660be74cb3979" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.google.firebase" name="firebase-components" version="17.1.5">
<artifact name="firebase-components-17.1.5.aar">
<sha256 value="e4c133f8055b1894814ad169028e17f6b214838d0b6787268dcefdc09d4e9dbf" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
<artifact name="firebase-components-17.1.5.pom">
<sha256 value="e781684bd1d2132ab32ba29c419ba2174ff8983edeb4d93782178e8b6dc6f804" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.google.firebase" name="firebase-datatransport" version="18.1.7">
<artifact name="firebase-datatransport-18.1.7.aar">
<sha256 value="5f23d5750ae248dca2312c5963aa89f851be36132fb89f15114c3585e605ff08" origin="Generated by Gradle" reason="Artifact is not signed"/>
@ -4091,6 +4136,14 @@
<sha256 value="3dc928b30fed7b3f68b5cbb349434447a217adbbb14886e072f861860f5911f7" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.google.firebase" name="firebase-installations" version="17.2.0">
<artifact name="firebase-installations-17.2.0.aar">
<sha256 value="de011e6a3b7961de638f172f2cb66ba304eaa989662a9e2b0f48dff774ccc166" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
<artifact name="firebase-installations-17.2.0.pom">
<sha256 value="a6170ae3937d27040149944eecb241f04dafdd0177c9efe3c023af9a1c143a03" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.google.firebase" name="firebase-installations-interop" version="17.1.0">
<artifact name="firebase-installations-interop-17.1.0.aar">
<sha256 value="891f3ea799bb3f39b24bf94bb6d951424dde784b5c9b5af1def4bab798705d8d" origin="Generated by Gradle" reason="Artifact is not signed"/>
@ -4099,6 +4152,14 @@
<sha256 value="d136fc08269596e50858ada73ddd6a48095bbe8ad69a7718d62dd73899fb44ca" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.google.firebase" name="firebase-installations-interop" version="17.1.1">
<artifact name="firebase-installations-interop-17.1.1.aar">
<sha256 value="fac650680f7921f4ab92f0bb21a09234b12cdaefab2cf70188281d7ea52b8dad" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
<artifact name="firebase-installations-interop-17.1.1.pom">
<sha256 value="9e11fa12d1e36351fab18527d18f8a771cb3b5e6e793f20ccfaca157260ecaa8" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.google.firebase" name="firebase-measurement-connector" version="19.0.0">
<artifact name="firebase-measurement-connector-19.0.0.aar">
<sha256 value="dba74d6bf94647ee397bf7afb2ab07f6fe8d13157e56785fa540a2a13ed82c99" origin="Generated by Gradle" reason="Artifact is not signed"/>
@ -4115,6 +4176,14 @@
<sha256 value="e2f26fa8e7ccdb9757da309df64066de1bc810706ad8636e509725cfad66f9a6" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.google.firebase" name="firebase-messaging" version="23.4.1">
<artifact name="firebase-messaging-23.4.1.aar">
<sha256 value="15c2637c28fb6895b6a4c998a191b663f3b78ac815f6ac59ab7d673a8d9af202" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
<artifact name="firebase-messaging-23.4.1.pom">
<sha256 value="188ee169e2d73488e9b14c7610bf3fd9a834658c0759af51b16b0b255865f7c6" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.google.flatbuffers" name="flatbuffers-java" version="1.12.0">
<artifact name="flatbuffers-java-1.12.0.jar">
<sha256 value="3f8c088b4dd04a9858721f2e162508c94db0dd86f961e306ee63ef2eda871bf7" origin="Generated by Gradle"/>

View file

@ -73,7 +73,7 @@ fi
if [[ $4 = "all" ]]; then
scripts/runAllScreenshotCombinations "noCI" "$1" "-Pandroid.testInstrumentationRunnerArguments.class=$class$method"
else
./gradlew --offline gplayDebugExecuteScreenshotTests $record \
SHOT_TEST=true ./gradlew --offline gplayDebugExecuteScreenshotTests $record \
-Dorg.gradle.jvmargs="--add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.nio.channels=ALL-UNNAMED --add-exports java.base/sun.nio.ch=ALL-UNNAMED" \
-Pscreenshot=true \
-Pandroid.testInstrumentationRunnerArguments.annotation=com.owncloud.android.utils.ScreenshotTest \