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

Test and clean up PlayQueue #6345

Merged
merged 20 commits into from
May 26, 2021

Conversation

imericxu
Copy link
Contributor

@imericxu imericxu commented May 21, 2021

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

  • Unit test PlayQueue class
  • Clean up and refactor class as necessary (no major changes)
    • Fix edge cases in setIndex(int): void

APK testing

On the website, the APK can be found by going to the "Checks" tab below the title and then on "artifacts" on the right.

Due diligence

@AudricV AudricV added the codequality Improvements to the codebase to improve the code quality label May 22, 2021
@imericxu imericxu marked this pull request as ready for review May 22, 2021 17:41
@XiangRongLin
Copy link
Collaborator

Other than that it looks good to go for me

 - Remove multiple casts of obj

 - Simply use object equals on the streams because PlayQueueItem’s
   equals already compares urls
Assignments that don't require the constructor can be moved out.
Original did not cover the case of when streams is empty and
documentation does not specify any input restrictions.

There's an ambiguity with broadcasting an event between the
documentation and the actual code (see TODO).
PlayQueueItem overrides equals and hashCode, so using indexOf is
perfectly fine.
Final fields should be arranged first
Stops Android Studio from "recognizing" them as tests
 - Add early return for invalid sizes to shuffle

 - Rename variables to be more descriptive

 - Refactor moving list element, removing unnecessary operations

 - Unwrap if clause for adding to history because the condition is
   guaranteed by the guard clause

 - Inline the value 0 for the ReorderEvent

 - Update documentation to reflect new changes
After testing the app, I realized that shuffling a queue with size 2
does nothing
@imericxu
Copy link
Contributor Author

I noticed that the outOfBoundsNotComplete test takes much longer than the rest of the tests; 1 whole second as compared to milliseconds. Could it be the spy and is this an issue?

Does not affect Gradle tests and only benefits IDE workflow
@XiangRongLin
Copy link
Collaborator

I noticed that the outOfBoundsNotComplete test takes much longer than the rest of the tests; 1 whole second as compared to milliseconds. Could it be the spy and is this an issue?

But aren't the spies used in every test? What i know of is, that the first tests always takes the longest, because it gets all the overhead of initializing stuff

@XiangRongLin
Copy link
Collaborator

@TobiGr Should this be squashed before merging? On one hand, it's 20 commits, on the other hand, some of them do have usefull messages that may be worth keeping

@XiangRongLin
Copy link
Collaborator

No complaints means no problems 🤷

@XiangRongLin XiangRongLin merged commit 8080c32 into TeamNewPipe:dev May 26, 2021
@imericxu imericxu deleted the test-and-update-playqueue branch May 26, 2021 15:58
This was referenced Jun 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codequality Improvements to the codebase to improve the code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants