mirror of
https://github.com/nextcloud/android.git
synced 2024-11-22 05:05:31 +03:00
Merge pull request #13297 from nextcloud/feature/add-sso-activity-test
Add SSO Activity Theme Correctness Test
This commit is contained in:
commit
7935e4463f
2 changed files with 42 additions and 2 deletions
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Nextcloud - Android Client
|
||||
*
|
||||
* SPDX-FileCopyrightText: 2024 Alper Ozturk <alper.ozturk@nextcloud.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package com.nextcloud.client.sso
|
||||
|
||||
import androidx.test.espresso.intent.rule.IntentsTestRule
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.ui.activity.SsoGrantPermissionActivity
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
|
||||
class SSOActivityTests : AbstractIT() {
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@get:Rule
|
||||
var activityRule = IntentsTestRule(SsoGrantPermissionActivity::class.java, true, false)
|
||||
|
||||
@Test
|
||||
fun testActivityTheme() {
|
||||
val sut = activityRule.launchActivity(null)
|
||||
assert(sut.binding != null)
|
||||
assert(sut.materialAlertDialogBuilder != null)
|
||||
}
|
||||
}
|
|
@ -69,13 +69,19 @@ public class SsoGrantPermissionActivity extends BaseActivity {
|
|||
|
||||
private AlertDialog dialog;
|
||||
|
||||
private DialogSsoGrantPermissionBinding binding;
|
||||
|
||||
public DialogSsoGrantPermissionBinding getBinding() {
|
||||
return binding;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
viewThemeUtils = themeUtilsFactory.withDefaultSchemes();
|
||||
|
||||
DialogSsoGrantPermissionBinding binding = DialogSsoGrantPermissionBinding.inflate(getLayoutInflater());
|
||||
binding = DialogSsoGrantPermissionBinding.inflate(getLayoutInflater());
|
||||
|
||||
ComponentName callingActivity = getCallingActivity();
|
||||
|
||||
|
@ -101,7 +107,9 @@ public class SsoGrantPermissionActivity extends BaseActivity {
|
|||
Log_OC.e(TAG, "Error retrieving app icon", e);
|
||||
}
|
||||
|
||||
final MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this)
|
||||
MaterialAlertDialogBuilder builder = getMaterialAlertDialogBuilder();
|
||||
|
||||
builder
|
||||
.setView(binding.getRoot())
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(R.string.permission_allow, (dialog, which) -> grantPermission())
|
||||
|
@ -121,6 +129,10 @@ public class SsoGrantPermissionActivity extends BaseActivity {
|
|||
}
|
||||
}
|
||||
|
||||
public MaterialAlertDialogBuilder getMaterialAlertDialogBuilder() {
|
||||
return new MaterialAlertDialogBuilder(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
|
Loading…
Reference in a new issue