-
Notifications
You must be signed in to change notification settings - Fork 804
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
Refactor ActivityListModel population mechanisms #4736
Conversation
1e65268
to
bdbf5c4
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #4736 +/- ##
=======================================
Coverage 57.20% 57.20%
=======================================
Files 138 138
Lines 17138 17138
=======================================
Hits 9804 9804
Misses 7334 7334 |
/backport to stable-3.5 |
bdbf5c4
to
ad4809f
Compare
I would prefer not to backport in case that would induce regressions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please handle the automated comments from sonarcloud has many of them provide feedback that would need to be addressed
f65e80c
to
57a5fc8
Compare
SonarCloud Quality Gate failed. |
|
||
const auto index = model.index(0, 0); | ||
QVERIFY(index.isValid()); | ||
testActivityAdd(&TestingALM::addSyncFileItemToActivityList, testSyncFileItemActivity); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test and the few next ones would be better written as data driven tests with different data instead of doing an utility method and calling it manually several time
see https://doc.qt.io/qt-5/qttestlib-tutorial2-example.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure, what we want to test here is that the activity is added to the activity list correctly, and that it returns the right data, right? For the latter we have the data
testing function, in the test slots that take these methods we are testing if the activity is actually added properly
I am not sure what benefit using the QTest data table would bring, in our case it seems it would add more complexity as we would still need to create the activity objects and keep them around, add the activity data we want to test to the QTest table, and then test the table rows vs. just testing the data we get from the table with the data in the activity we are retaining directly
Am I misunderstanding the purpose of the QTest data table?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say that the data driven tests are the thing you have to use when you want to run teh same code multiple time with different input values
so sounded to me like the solution here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a lot of reason for the table as we need to keep the activity objects around and these are never changed. We can just compare these directly, at least as I see it -- we instantiate the activities once in the constructor and that is it, we don't need to re-create new activities in each test
The polymorphic way of testing the methods is just there to remove the need for repeating the same lines of code checking for things over and over (which we would have to do with data driven tests anyway)
57a5fc8
to
4fdc78d
Compare
Ahh nice, so this also fixes the issue of old Talk notifications which were already seen via other apps still showing up? :) |
Not really; as I know we do not receive a list of completed notifications from the server which would let us filter out notifications from our presently-shown notifications. But this should prevent showing duplicates |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😴 Would be great to have the PR contain multiple small self-explanatory commits, in the future, when possible, to ease the review with so many changes.
@claucambra Just, please don't forget to fix the build |
6baa5ff
to
cc7721e
Compare
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
cc7721e
to
1a5fa50
Compare
SonarCloud Quality Gate failed. |
AppImage file: nextcloud-PR-4736-1a5fa50fbbfb006232fcc9d92733cdf2e9573056-x86_64.AppImage |
Signed-off-by: Claudio Cambra claudio.cambra@gmail.com
As it stands, the
ActivityListModel
has two issues:This refactoring eliminates these issues, which in turn also prevents the activity list view resetting every time something changes (i.e. receiving new activities, dismissing notifications, etc.) by updating the core data list granularly rather than coarsely. This addresses a point in #4432
NOTE: this PR depends on #4735 as it removes the
clearNotifications
method which goes unused after the internal refactoring ofActivityListModel
and the removal ofclearNotifications
from theUserModel
in #4735Fixes #4724