Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue-5662-kotlinstyle #5833

Merged
merged 25 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4aca2a2
*.kt: bulk correction of formatting using ktlint --format
tristan81 Sep 18, 2024
bc7c591
*.kt: replace wildcard imports and second stage auto format ktlint --…
tristan81 Sep 18, 2024
1e5d26e
QuizQuestionTest.kt: modified property names to camel case to meet kt…
tristan81 Sep 18, 2024
07e466c
LevelControllerTest.kt: modified property names to camel case to meet…
tristan81 Sep 18, 2024
b6c943e
QuizActivityUnitTest.kt: modified property names to camel case to mee…
tristan81 Sep 18, 2024
88d853e
MediaDetailFragmentUnitTests.kt: modified property names to camel cas…
tristan81 Sep 18, 2024
564906a
UploadWorker.kt: modified property names to camel case to meet ktlint…
tristan81 Sep 18, 2024
ed9a37c
UploadClient.kt: modified property names to camel case to meet ktlint…
tristan81 Sep 18, 2024
bcf682f
BasePagingPresenter.kt: modified property names to camel case to meet…
tristan81 Sep 18, 2024
a12cd67
DescriptionEditActivity.kt: modified property names to camel case to …
tristan81 Sep 18, 2024
0204385
OnSwipeTouchListener.kt: modified property names to camel case to mee…
tristan81 Sep 18, 2024
94a007c
MediaDetailFragmentUnitTests.kt: corrected excessive line length to m…
tristan81 Sep 18, 2024
c6dd524
DepictedItem.kt: corrected property name format and catch format to f…
tristan81 Sep 18, 2024
45103b5
UploadCategoryAdapter.kt: corrected class definition format to meet k…
tristan81 Sep 18, 2024
b33f562
CustomSelectorActivity.kt: reformatted function names to first letter…
tristan81 Sep 18, 2024
622410d
MediaDetailFragmentUnitTests.kt: fix string literal indentation to me…
tristan81 Sep 18, 2024
c2c66e6
NotForUploadDao.kt: file renamed to match class name, new file NotFor…
tristan81 Sep 18, 2024
5550901
UploadedDao.kt: file renamed to match class name, new file UploadedSt…
tristan81 Sep 18, 2024
e074424
Urls.kt: fixed excessive line length for ktLint standard
tristan81 Sep 18, 2024
4717ce0
Snak_partial.kt & Statement_partial.kt: refactored to remove undersco…
tristan81 Sep 18, 2024
9d9cd5a
*.kt: fixed consecutive KDOC error for ktLint
tristan81 Sep 18, 2024
0e21045
PageableBaseDataSourceTest.kt & UploadPresenterTest.kt: fixed excessi…
tristan81 Sep 18, 2024
131dd93
CheckboxTriStatesTest.kt: renamed file to match class name to meet kt…
tristan81 Sep 18, 2024
9dce683
.kt: resolved backing-property-naming error in ktLint, made matching …
tristan81 Sep 18, 2024
0ccfba5
TestConnectionFactory.kt: fixed property naming to adhere to ktLint s…
tristan81 Sep 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
48 changes: 26 additions & 22 deletions app/src/androidTest/java/fr/free/nrw/commons/AboutActivityTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class AboutActivityTest {

@get:Rule
var activityRule: ActivityTestRule<*> = ActivityTestRule(AboutActivity::class.java)

Expand All @@ -36,7 +35,8 @@ class AboutActivityTest {
device.setOrientationNatural()
device.freezeRotation()
Intents.init()
Intents.intending(CoreMatchers.not(IntentMatchers.isInternal()))
Intents
.intending(CoreMatchers.not(IntentMatchers.isInternal()))
.respondWith(Instrumentation.ActivityResult(Activity.RESULT_OK, null))
}

Expand All @@ -47,11 +47,12 @@ class AboutActivityTest {

@Test
fun testBuildNumber() {
Espresso.onView(ViewMatchers.withId(R.id.about_version))
Espresso
.onView(ViewMatchers.withId(R.id.about_version))
.check(
ViewAssertions.matches(
withText(getApplicationContext<CommonsApplication>().getVersionNameWithSha())
)
withText(getApplicationContext<CommonsApplication>().getVersionNameWithSha()),
),
)
}

Expand All @@ -61,8 +62,8 @@ class AboutActivityTest {
Intents.intended(
CoreMatchers.allOf(
IntentMatchers.hasAction(Intent.ACTION_VIEW),
IntentMatchers.hasData(Urls.WEBSITE_URL)
)
IntentMatchers.hasData(Urls.WEBSITE_URL),
),
)
}

Expand All @@ -73,8 +74,8 @@ class AboutActivityTest {
CoreMatchers.anyOf(
IntentMatchers.hasAction(Intent.ACTION_VIEW),
IntentMatchers.hasData(Urls.FACEBOOK_WEB_URL),
IntentMatchers.hasPackage(Urls.FACEBOOK_PACKAGE_NAME)
)
IntentMatchers.hasPackage(Urls.FACEBOOK_PACKAGE_NAME),
),
)
}

Expand All @@ -84,8 +85,8 @@ class AboutActivityTest {
Intents.intended(
CoreMatchers.allOf(
IntentMatchers.hasAction(Intent.ACTION_VIEW),
IntentMatchers.hasData(Urls.GITHUB_REPO_URL)
)
IntentMatchers.hasData(Urls.GITHUB_REPO_URL),
),
)
}

Expand All @@ -95,8 +96,8 @@ class AboutActivityTest {
Intents.intended(
CoreMatchers.allOf(
IntentMatchers.hasAction(Intent.ACTION_VIEW),
IntentMatchers.hasData(BuildConfig.PRIVACY_POLICY_URL)
)
IntentMatchers.hasData(BuildConfig.PRIVACY_POLICY_URL),
),
)
}

Expand All @@ -108,8 +109,8 @@ class AboutActivityTest {
Intents.intended(
CoreMatchers.allOf(
IntentMatchers.hasAction(Intent.ACTION_VIEW),
IntentMatchers.hasData("${Urls.TRANSLATE_WIKI_URL}$langCode")
)
IntentMatchers.hasData("${Urls.TRANSLATE_WIKI_URL}$langCode"),
),
)
}

Expand All @@ -119,27 +120,30 @@ class AboutActivityTest {
Intents.intended(
CoreMatchers.allOf(
IntentMatchers.hasAction(Intent.ACTION_VIEW),
IntentMatchers.hasData(Urls.CREDITS_URL)
)
IntentMatchers.hasData(Urls.CREDITS_URL),
),
)
}

@Test
fun testLaunchUserGuide() {
Espresso.onView(ViewMatchers.withId(R.id.about_user_guide)).perform(ViewActions.click())
Intents.intended(CoreMatchers.allOf(IntentMatchers.hasAction(Intent.ACTION_VIEW),
IntentMatchers.hasData(Urls.USER_GUIDE_URL)))
Intents.intended(
CoreMatchers.allOf(
IntentMatchers.hasAction(Intent.ACTION_VIEW),
IntentMatchers.hasData(Urls.USER_GUIDE_URL),
),
)
}


@Test
fun testLaunchAboutFaq() {
Espresso.onView(ViewMatchers.withId(R.id.about_faq)).perform(ViewActions.click())
Intents.intended(
CoreMatchers.allOf(
IntentMatchers.hasAction(Intent.ACTION_VIEW),
IntentMatchers.hasData(Urls.FAQ_URL)
)
IntentMatchers.hasData(Urls.FAQ_URL),
),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ import fr.free.nrw.commons.auth.LoginActivity
import fr.free.nrw.commons.auth.SignupActivity
import org.hamcrest.CoreMatchers
import org.hamcrest.CoreMatchers.not
import org.junit.*
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class LoginActivityTest {

@get:Rule
var activityRule = ActivityTestRule(LoginActivity::class.java)

Expand All @@ -49,8 +51,8 @@ class LoginActivityTest {
Intents.intended(
CoreMatchers.allOf(
IntentMatchers.hasAction(Intent.ACTION_VIEW),
IntentMatchers.hasData(BuildConfig.FORGOT_PASSWORD_URL)
)
IntentMatchers.hasData(BuildConfig.FORGOT_PASSWORD_URL),
),
)
}

Expand All @@ -64,4 +66,4 @@ class LoginActivityTest {
fun orientationChange() {
UITestHelper.changeOrientation(activityRule)
}
}
}
Loading
Loading