Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@EngDann
Copy link

@EngDann EngDann commented Oct 7, 2025

Explanation

Fix #5784

Before, the list of text and audio languages was bad sorted, so, as was proposed, I sorted the languages in alphabetic form, excluding the English from that sort and applying that as the first language.

Essential Checklist

  • The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • Any changes to scripts/assets files have their rationale included in the PR explanation.
  • The PR follows the style guide.
  • The PR does not contain any unnecessary code changes from Android Studio (reference).
  • The PR is made from a branch that's not called "develop" and is up-to-date with "develop".
  • The PR is assigned to the appropriate reviewers (reference).

For UI-specific PRs only

Before (Inconsistent Sort) After (Standardized Sort)
Video Video

Standardizes the ordering for App Language and Audio Language lists as English-first, then alphabetical
@EngDann EngDann requested a review from a team as a code owner October 7, 2025 19:31
@EngDann EngDann requested a review from manas-yu October 7, 2025 19:31
@manas-yu manas-yu self-assigned this Oct 8, 2025
@manas-yu
Copy link
Collaborator

manas-yu commented Oct 8, 2025

Hi @EngDann PTAL at the failing unit tests in CI and assign back, also make sure to write tests for the code changes as well. Thanks!

@manas-yu manas-yu assigned EngDann and unassigned manas-yu Oct 8, 2025
Copy link
Collaborator

@adhiamboperes adhiamboperes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this great solution, @EngDann!

As @manas-yu mentioned, please look at this wiki page to see how to locate failing tests in the CI report. An easy method I use is to click on the failing shard, then in the search bar, I type "failures", and I can easily navigate to the errors.

For information on how to run the tests locally on your machine, please see here.

Ps: Coverage related failures will automatically fix themselves once the tests pass.

@adhiamboperes
Copy link
Collaborator

Please let us know if you need any support with the fixes.

@EngDann
Copy link
Author

EngDann commented Oct 14, 2025

Hi @adhiamboperes and @manas-yu, thanks for the detailed feedback and the helpful links!

I'll aim to have the necessary test cases written and the PR updated by the end of this week. I don't need any support right now, but I'll definitely reach out if I hit a blocker. Thanks!

@EngDann EngDann requested a review from adhiamboperes October 16, 2025 15:23
Copy link
Collaborator

@adhiamboperes adhiamboperes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @EngDann for adding tests.

However, the tests have not been correctly written, and I have left some comments inline explaining that.

Also, I have noticed that you have not fixed the existing tests that are failing in the CI. In my previous comment, I left some links for you to look at, pointing towards the WIki pages about our CI. Please take a look and let me know if I can explain some things further.

Comment on lines 252 to 256
topicController.getTopic(
ProfileId.newBuilder().setInternalId(0).build(),
TEST_TOPIC_ID_0
).observeForever(mockTopicLiveDataObserver)
testCoroutineDispatchers.runCurrent()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems completely out of place. I don't think this test will compile at all. Did you run it locally?

).observeForever(mockTopicLiveDataObserver)
testCoroutineDispatchers.runCurrent()

launch<OptionsActivity>(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The activity under test is AudioLanguageActivity, not OptionsActivity, so this test will fail with build errors.

I suggest looking at other tests in this class to see how they are written, and using an identical set up for this new test.

Comment on lines 269 to 274
matches(
atPositionOnView(
0,
withText("English"),
R.id.language_radio_button
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assertion only verifies that English is in the first position, but it does not verify the remaining languages. The name of the test is testAudioLanguage_englishIsFirstThenAlphabetical, which means we expect to see the onView....matches(atPositionOnView..) for all the languages in the list.


@Test
fun testAppLanguage_englishIsFirstThenAlphabetical() {
launch(OptionsActivity::class.java).use {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The activity under test isAppLanguageActivity, not OptionsActivity, so this test will fail with build errors.

Please look at how the other tests in this class are written, and use the same format.

Comment on lines 251 to 263
onView(withId(R.id.language_recycler_view))
.perform(
scrollToPosition<RecyclerView.ViewHolder>(0)
).check(
matches(
atPositionOnView(
0,
withText("English"),
R.id.language_radio_button
)
)
)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assertion only verifies that English is in the first position, but it does not verify the remaining languages. The name of the test is testAudioLanguage_englishIsFirstThenAlphabetical, which means we expect to see the onView....matches(atPositionOnView..) for all the languages in the list.

Comment on lines 246 to 249
val fragment = activity.supportFragmentManager
.findFragmentByTag(TAG_APP_LANGUAGE_FRAGMENT) as AppLanguageFragment
testCoroutineDispatchers.runCurrent()
fragment.requireView().requestLayout()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not be necessary if you launch isAppLanguageActivity directly.

@EngDann
Copy link
Author

EngDann commented Oct 17, 2025

@adhiamboperes, thank you so much for the feedback!

I'm still learning how to write tests effectively for this project, and it has been a challenge for me, so your comments were very helpful. I will update the tests with all of your suggestions.

Regarding the other failing CI checks, I had some trouble accessing the logs last time as they had expired. I see they are available now, so I will investigate those failures and work on fixing them.

Thanks again for your help and patience!

@EngDann EngDann requested a review from adhiamboperes October 21, 2025 19:55
@EngDann
Copy link
Author

EngDann commented Oct 23, 2025

Hey @adhiamboperes!

I've pushed updates for all the feedback you gave me. I fixed the tests to launch the correct activities and check all the languages, like you pointed out.

Could you please take another look when you get a chance? Thanks!

Screenshot from 2025-10-23 16-16-50 Screenshot from 2025-10-23 16-17-48

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: The list of languages in the App Language and Preferred Audio Language is not the same order

3 participants