D11034: CoreApplicationSettingsTest

Johnny Jazeix noreply at phabricator.kde.org
Sat Mar 17 21:31:45 UTC 2018


jjazeix added a comment.


  In D11034#227329 <https://phabricator.kde.org/D11034#227329>, @himanshuvishwakarma wrote:
  
  > In D11034#226275 <https://phabricator.kde.org/D11034#226275>, @jjazeix wrote:
  >
  > > In D11034#224142 <https://phabricator.kde.org/D11034#224142>, @himanshuvishwakarma wrote:
  > >
  > > > yes, I agree with you that if the test is crash during the running it will change the default settings of the application.
  > > >
  > > > So, I think that the solution is that, I don't have to use the main settings( ~/.config/gcompris/gcompris-qt.conf ) of the application in our unit test. To achieve this, I tried with making DummyApplicationSettings class by inheriting the ApplicationSettings class and change access specifiers of m_config to protected and then tried to change the config file location but there is NO any function in the QSettings to change the location of the config file. So dummy class also changed the main settings of the application while running the test.
  > > >
  > > > The main problem is NO way to change the default location of the config file in the object of QSettings class.
  > > >
  > > > maybe wrong approach.
  > > > or
  > > >  maybe some other method may present to do the tests. but presently I have no idea what to do next in this test, I am searching... if anything I will get, I will update the diff.
  > >
  > >
  > > If you need to add some protected methods to change the settings, you can
  >
  >
  > I tried many times, but not getting any positive results.
  >
  > In the derived class(DummyApplicationSettings) inherits the object of the QSettings (m_config) after that I used this function to change the path of the config file location: http://doc.qt.io/qt-5/qsettings.html#setPath
  >  But this function doesn't affect existing QSettings objects.
  >
  > Therefore I removed that part of the unit test which is affecting the settings of GCompris because aqpplication settings are more important than a unit test.
  
  
  So your solution for unit testing this class would be to test nothing (the remaining tests you do also change the configuration file) :)?
  If you add a protected constructor taking the path as parameter and use it in to instantiate the inherited class, would it work?

REPOSITORY
  R2 GCompris

REVISION DETAIL
  https://phabricator.kde.org/D11034

To: himanshuvishwakarma, jjazeix, dmadaan, rudranilbasu, timotheegiet, #gcompris
Cc: #kde_edu, #gcompris, harrymecwan, ganeshredcobra, nityanandkumar, echarruau, rahulyadav, narvaez, scagarwal, apol, timotheegiet, hkaelberer, jjazeix, bcoudoin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-edu/attachments/20180317/2f020b46/attachment.html>


More information about the kde-edu mailing list