Skip to content

Commit

Permalink
Merge pull request #2750 from owncloud/cleanup_project
Browse files Browse the repository at this point in the history
Cleanup project
  • Loading branch information
davigonz authored Dec 18, 2019
2 parents df22b16 + 1609e67 commit 5ba41d5
Show file tree
Hide file tree
Showing 278 changed files with 765 additions and 2,586 deletions.
12 changes: 3 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,11 @@
# Java class files
*.class

# generated files
bin/
build/
*.iml
gen/
target/

# Local configuration files (sdk path, etc)
local.properties
oc_framework/local.properties
oc_framework-test-project/local.properties
tests/local.properties
lint.xml

# Mac .DS_Store files
.DS_Store
Expand All @@ -33,13 +25,15 @@ tests/proguard-project.txt

# Android Studio and Gradle specific entries
.gradle
.idea
*.iml
build

# android sdk captures folder
captures

# ignore lint html and xml output
lint-*ml

!.idea/
.idea/*
!.idea/codeStyles/
Expand Down
7 changes: 5 additions & 2 deletions owncloudApp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,11 @@ android {
}

lintOptions {
abortOnError false
disable 'MissingTranslation'
abortOnError true
ignoreWarnings false

xmlReport false
htmlOutput file("../lint-app-report.html")
}

packagingOptions {
Expand Down
4 changes: 4 additions & 0 deletions owncloudApp/lint.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="MissingTranslation" severity="ignore" />
</lint>
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,20 @@ class OCSettingsCameraUploadsTest {

private val context = InstrumentationRegistry.getInstrumentation().targetContext

private val CAMERA_PICTURE_UPLOADS = "camera_picture_uploads"
private val CAMERA_VIDEO_UPLOADS = "camera_video_uploads"
private val cameraPictureUploads = "camera_picture_uploads"
private val cameraVideoUploads = "camera_video_uploads"

private lateinit var mPrefCameraPictureUploads: CheckBoxPreference
private lateinit var mPrefCameraVideoUploads: CheckBoxPreference

@Before
fun setUp() {

mPrefCameraPictureUploads = activityRule.activity.findPreference(CAMERA_PICTURE_UPLOADS) as CheckBoxPreference
mPrefCameraVideoUploads = activityRule.activity.findPreference(CAMERA_VIDEO_UPLOADS) as CheckBoxPreference
mPrefCameraPictureUploads = activityRule.activity.findPreference(cameraPictureUploads) as CheckBoxPreference
mPrefCameraVideoUploads = activityRule.activity.findPreference(cameraVideoUploads) as CheckBoxPreference

//Only interested in "Camera Uploads" section, so we can get rid of the other categories.
val preferenceScreen = activityRule.activity.getPreferenceScreen() as PreferenceScreen
val preferenceScreen = activityRule.activity.preferenceScreen as PreferenceScreen
val securityCategory =
activityRule.activity.findPreference("security_category") as PreferenceCategory
val moreCategory =
Expand Down Expand Up @@ -123,7 +123,7 @@ class OCSettingsCameraUploadsTest {

@Test
fun enablePictureUploads() {
onView(withText(R.string.prefs_camera_picture_upload)).perform(click());
onView(withText(R.string.prefs_camera_picture_upload)).perform(click())
onView(withText(android.R.string.ok)).perform(click())
//Asserts
assertTrue(mPrefCameraPictureUploads.isChecked)
Expand All @@ -133,7 +133,7 @@ class OCSettingsCameraUploadsTest {

@Test
fun enableVideoUploads() {
onView(withText(R.string.prefs_camera_video_upload)).perform(click());
onView(withText(R.string.prefs_camera_video_upload)).perform(click())
onView(withText(android.R.string.ok)).perform(click())
//Asserts
assertTrue(mPrefCameraVideoUploads.isChecked)
Expand All @@ -144,8 +144,8 @@ class OCSettingsCameraUploadsTest {
@Test
fun disablePictureUploadsAccept() {
enableCameraPictureUploads()
onView(withText(R.string.prefs_camera_picture_upload)).perform(click());
onView(withText(R.string.common_yes)).perform(click());
onView(withText(R.string.prefs_camera_picture_upload)).perform(click())
onView(withText(R.string.common_yes)).perform(click())
//Asserts
assertFalse(mPrefCameraPictureUploads.isChecked)
onView(withText(R.string.prefs_camera_picture_upload_path_title)).check(doesNotExist())
Expand All @@ -155,8 +155,8 @@ class OCSettingsCameraUploadsTest {
@Test
fun disablePictureUploadsRefuse() {
enableCameraPictureUploads()
onView(withText(R.string.prefs_camera_picture_upload)).perform(click());
onView(withText(R.string.common_no)).perform(click());
onView(withText(R.string.prefs_camera_picture_upload)).perform(click())
onView(withText(R.string.common_no)).perform(click())
//Asserts
assertTrue(mPrefCameraPictureUploads.isChecked)
onView(withText(R.string.prefs_camera_picture_upload_path_title)).check(matches(isDisplayed()))
Expand All @@ -166,8 +166,8 @@ class OCSettingsCameraUploadsTest {
@Test
fun disableVideoUploadsAccept() {
enableCameraVideoUploads()
onView(withText(R.string.prefs_camera_video_upload)).perform(click());
onView(withText(R.string.common_yes)).perform(click());
onView(withText(R.string.prefs_camera_video_upload)).perform(click())
onView(withText(R.string.common_yes)).perform(click())
//Asserts
assertFalse(mPrefCameraVideoUploads.isChecked)
onView(withText(R.string.prefs_camera_video_upload_path_title)).check(doesNotExist())
Expand All @@ -177,8 +177,8 @@ class OCSettingsCameraUploadsTest {
@Test
fun disableVideoUploadsRefuse() {
enableCameraVideoUploads()
onView(withText(R.string.prefs_camera_video_upload)).perform(click());
onView(withText(R.string.common_no)).perform(click());
onView(withText(R.string.prefs_camera_video_upload)).perform(click())
onView(withText(R.string.common_no)).perform(click())
//Asserts
assertTrue(mPrefCameraVideoUploads.isChecked)
onView(withText(R.string.prefs_camera_video_upload_path_title)).check(matches(isDisplayed()))
Expand All @@ -205,7 +205,7 @@ class OCSettingsCameraUploadsTest {
enableCameraPictureUploads()
val cameraFolder = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_DCIM
).absolutePath + "/Camera";
).absolutePath + "/Camera"
Intents.init()
//Asserts
onView(
Expand All @@ -226,19 +226,19 @@ class OCSettingsCameraUploadsTest {
@Test
fun switchOriginalFileWillBe() {
enableCameraPictureUploads()
onData(PreferenceMatchers.withTitle(R.string.prefs_camera_upload_behaviour_title)).perform(click());
onData(PreferenceMatchers.withTitle(R.string.prefs_camera_upload_behaviour_title)).perform(click())
onView(withText(R.string.pref_behaviour_entries_move)).perform(click())
//Asserts
onView(withText(R.string.pref_behaviour_entries_move)).check(matches(isDisplayed()))
}

fun enableCameraPictureUploads() {
onView(withText(R.string.prefs_camera_picture_upload)).perform(click());
private fun enableCameraPictureUploads() {
onView(withText(R.string.prefs_camera_picture_upload)).perform(click())
onView(withText(android.R.string.ok)).perform(click())
}

fun enableCameraVideoUploads() {
onView(withText(R.string.prefs_camera_video_upload)).perform(click());
private fun enableCameraVideoUploads() {
onView(withText(R.string.prefs_camera_video_upload)).perform(click())
onView(withText(android.R.string.ok)).perform(click())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class OCSettingsLocalFolderPickerTest {
@JvmField
val activityRule = ActivityTestRule(LocalFolderPickerActivity::class.java, true, true)

val errorMessage = "Activity not finished"
private val errorMessage = "Activity not finished"

@Test
fun localFolderPickerView() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class OCSettingsMoreTest {
Intents.init()
//Only interested in "More" section, so we can get rid of the other categories. SmoothScroll is not
//working fine to reach the bottom of the screen, so this approach was taken to display the section
val preferenceScreen = activityRule.activity.getPreferenceScreen() as PreferenceScreen
val preferenceScreen = activityRule.activity.preferenceScreen as PreferenceScreen
val cameraUploadsCategory =
activityRule.activity.findPreference("camera_uploads_category") as PreferenceCategory
val securityCategory =
Expand All @@ -84,7 +84,7 @@ class OCSettingsMoreTest {
fun helpOptionOpensWeb() {
onView(withText(R.string.prefs_help)).perform(click())
val intentResult = ActivityResult(Activity.RESULT_OK, Intent())
intending(hasAction(Intent.ACTION_VIEW)).respondWith(intentResult);
intending(hasAction(Intent.ACTION_VIEW)).respondWith(intentResult)
intended(hasData(activityRule.activity.getString(R.string.url_help)))
}

Expand All @@ -97,7 +97,7 @@ class OCSettingsMoreTest {
@Test
fun davx5OpensLink() {
val intentResult = ActivityResult(Activity.RESULT_OK, Intent())
intending(hasAction(Intent.ACTION_VIEW)).respondWith(intentResult);
intending(hasAction(Intent.ACTION_VIEW)).respondWith(intentResult)
onView(withText(R.string.prefs_sync_calendar_contacts)).perform(click())
intended(hasData(activityRule.activity.getString(R.string.url_sync_calendar_contacts)))
}
Expand All @@ -110,7 +110,7 @@ class OCSettingsMoreTest {
@Test
fun recommendOpenSender() {
val intentResult = ActivityResult(Activity.RESULT_OK, Intent())
intending(hasAction(Intent.ACTION_SENDTO)).respondWith(intentResult);
intending(hasAction(Intent.ACTION_SENDTO)).respondWith(intentResult)
onView(withText(R.string.prefs_recommend)).perform(click())
intended(
allOf(
Expand Down Expand Up @@ -143,7 +143,7 @@ class OCSettingsMoreTest {
@Test
fun feedbackOpenSender() {
val intentResult = ActivityResult(Activity.RESULT_OK, Intent())
intending(hasAction(Intent.ACTION_SENDTO)).respondWith(intentResult);
intending(hasAction(Intent.ACTION_SENDTO)).respondWith(intentResult)
onView(withText(R.string.drawer_feedback)).perform(click())
intended(
allOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ class OCSettingsPasscodeTest {
@JvmField
val activityRule = ActivityTestRule(PassCodeActivity::class.java, true, false)

val intent = Intent()
val errorMessage = "PassCode Activity error"
private val KEY_PASSCODE = "KEY_PASSCODE"
private val intent = Intent()
private val errorMessage = "PassCode Activity error"
private val keyPassCode = "KEY_PASSCODE"
private val context = InstrumentationRegistry.getInstrumentation().targetContext

private val DEFAULT_PASSCODE = arrayOf('1', '1', '1', '1')
private val WRONG_PASSCODE = arrayOf('1', '1', '1', '2')
private val PASSCODE_TOSAVE = "1111"
private val defaultPassCode = arrayOf('1', '1', '1', '1')
private val wrongPassCode = arrayOf('1', '1', '1', '2')
private val passCodeToSave = "1111"

@After
fun tearDown() {
Expand Down Expand Up @@ -87,7 +87,7 @@ class OCSettingsPasscodeTest {
openPasscodeActivity(PassCodeActivity.ACTION_REQUEST_WITH_RESULT)

//First typing
typePasscode(DEFAULT_PASSCODE)
typePasscode(defaultPassCode)

onView(withText(R.string.pass_code_reenter_your_pass_code)).check(matches(isDisplayed()))
onView(withText(R.string.pass_code_configure_your_pass_code)).check(doesNotExist())
Expand All @@ -99,13 +99,13 @@ class OCSettingsPasscodeTest {
openPasscodeActivity(PassCodeActivity.ACTION_REQUEST_WITH_RESULT)

//First typing
typePasscode(DEFAULT_PASSCODE)
typePasscode(defaultPassCode)
//Second typing
typePasscode(DEFAULT_PASSCODE)
typePasscode(defaultPassCode)

//Checking that the setResult returns the typed passcode
assertThat(activityRule.activityResult, hasResultCode(Activity.RESULT_OK))
assertThat(activityRule.activityResult, hasResultData(hasExtra(KEY_PASSCODE, PASSCODE_TOSAVE)))
assertThat(activityRule.activityResult, hasResultData(hasExtra(keyPassCode, passCodeToSave)))

assertTrue(errorMessage, activityRule.activity.isFinishing)
}
Expand All @@ -117,9 +117,9 @@ class OCSettingsPasscodeTest {
openPasscodeActivity(PassCodeActivity.ACTION_REQUEST_WITH_RESULT)

//First typing
typePasscode(DEFAULT_PASSCODE)
typePasscode(defaultPassCode)
//Second typing
typePasscode(WRONG_PASSCODE)
typePasscode(wrongPassCode)

onView(withText(R.string.pass_code_reenter_your_pass_code)).check(doesNotExist())
onView(withText(R.string.pass_code_configure_your_pass_code)).check(matches(isDisplayed()))
Expand All @@ -146,7 +146,7 @@ class OCSettingsPasscodeTest {
openPasscodeActivity(PassCodeActivity.ACTION_REQUEST_WITH_RESULT)

//First typing
typePasscode(DEFAULT_PASSCODE)
typePasscode(defaultPassCode)

onView(withId(R.id.txt0)).perform(replaceText("1"))
onView(withId(R.id.txt1)).perform(replaceText("1"))
Expand All @@ -169,27 +169,27 @@ class OCSettingsPasscodeTest {
@Test
fun deletePasscodeCorrect() {
//Save a passcode in Preferences
storePasscode(PASSCODE_TOSAVE)
storePasscode(passCodeToSave)

//Open Activity in passcode deletion mode
openPasscodeActivity(PassCodeActivity.ACTION_CHECK_WITH_RESULT)

//Type correct passcode
typePasscode(DEFAULT_PASSCODE)
typePasscode(defaultPassCode)

assertTrue(errorMessage, activityRule.activity.isFinishing)
}

@Test
fun deletePasscodeIncorrect() {
//Save a passcode in Preferences
storePasscode(PASSCODE_TOSAVE)
storePasscode(passCodeToSave)

//Open Activity in passcode deletion mode
openPasscodeActivity(PassCodeActivity.ACTION_CHECK_WITH_RESULT)

//Type incorrect passcode
typePasscode(WRONG_PASSCODE)
typePasscode(wrongPassCode)

onView(withText(R.string.pass_code_enter_pass_code)).check(matches(isDisplayed()))
}
Expand All @@ -206,8 +206,8 @@ class OCSettingsPasscodeTest {
onView(withId(R.id.txt3)).perform(replaceText(digits[3].toString()))
}

private fun storePasscode(passcode: String = PASSCODE_TOSAVE) {
val appPrefs = PreferenceManager.getDefaultSharedPreferences(context).edit();
private fun storePasscode(passcode: String = passCodeToSave) {
val appPrefs = PreferenceManager.getDefaultSharedPreferences(context).edit()
for (i in 1..4) {
appPrefs.putString(
PassCodeActivity.PREFERENCE_PASSCODE_D + i,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ class OCSettingsPatternLockTest {
@Rule
@JvmField
val activityRule = ActivityTestRule(PatternLockActivity::class.java, true, false)
val errorMessage = "PatternLock Activity error"
val intent = Intent()
private val intent = Intent()
private val context = InstrumentationRegistry.getInstrumentation().targetContext

private val PATTERN_TOSAVE = "1234"
private val patternToSave = "1234"

@After
fun tearDown() {
Expand Down Expand Up @@ -75,8 +74,8 @@ class OCSettingsPatternLockTest {
}

private fun storePattern() {
val appPrefs = PreferenceManager.getDefaultSharedPreferences(context).edit();
appPrefs.putString(PatternLockActivity.KEY_PATTERN, PATTERN_TOSAVE)
val appPrefs = PreferenceManager.getDefaultSharedPreferences(context).edit()
appPrefs.putString(PatternLockActivity.KEY_PATTERN, patternToSave)
appPrefs.putBoolean(PatternLockActivity.PREFERENCE_SET_PATTERN, true)
appPrefs.apply()
}
Expand Down
Loading

0 comments on commit 5ba41d5

Please sign in to comment.