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

nmc/add new unit test files #5867

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AnkurBavisa
Copy link

Added new Unit Test files(which are not present in Nextcloud repo) with template, dependent header files and some member access dependency.
Later we will add testcase for NMC changes & nextcloud can also add test cases.

@nextcloud-desktop-bot
Copy link

AppImage file: nextcloud-PR-5867-2f4a680ba113f2618a01fd27d1655184cd968fd6-x86_64.AppImage

To test this change/fix you can simply download above AppImage file and test it.

Please make sure to quit your existing Nextcloud app and backup your data.

Copy link
Collaborator

@mgallien mgallien left a comment

Choose a reason for hiding this comment

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

please see my comments about #define private public
during the first review, I had overlook that you are testing some qml components
this PR lacking the content of the tests makes it a bit difficult to review those tests but I am really surprised by the way you are writing qml tests ?
I would really recommend following the approach of having a generic qml tests runner and then writing qml test code ?
a bit like what they explain in their doc

Comment on lines +12 to +14
#define private public
#include "folderstatusdelegate.h"
#undef private
Copy link
Collaborator

@mgallien mgallien Jul 13, 2023

Choose a reason for hiding this comment

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

this "trick" will work because we are using a static library
if we would have been using a shared library (DLL on windows) I think that would fail because the symbol mangling is different for private/public class members (see https://en.wikiversity.org/wiki/Visual_C%2B%2B_name_mangling#Complex_Type_(union,_struct,_class,_coclass,_cointerface) and https://www.qt.io/blog/2009/08/12/some-thoughts-on-binary-compatibility)
I would not block this PR only based on that but

  • we would be unable to keep using that if our code was moved to a shared library (DLL)
  • I am not convinced of automated tests using private interfaces
  • That creates heavy coupling of the tests to the current internal implementation

why not "just" make your test a friend of the class you are testing ? That would also be more in line with the current state of the automated tests of the desktop client ?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, friend class is very simple and easy solution, I avoided this because of only data/member privacy concern.
but if this is not major concern then I will apply the same.

Comment on lines +16 to +21
#define private public
#include "accountstate.h"
#include "syncresult.h"
#include "folder.h"
#include "theme.h"
#undef private
Copy link
Collaborator

Choose a reason for hiding this comment

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

same comment

#include "theme.h"
#include "folderman.h"
#include "configfile.h"
#define private public
Copy link
Collaborator

Choose a reason for hiding this comment

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

same comment

@mgallien
Copy link
Collaborator

DCO check is failing
@AnkurBavisa may I provide help ?

@@ -153,6 +154,7 @@ private slots:
bool _dirty = false; // If the selective sync checkboxes were changed

bool _isSyncRunningForAwhile = false;
friend class:: TestFolderStatusModel;// for Unit Test
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
friend class:: TestFolderStatusModel;// for Unit Test
friend class ::TestFolderStatusModel; // for Unit Test

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.

4 participants