Review Request 125877: Fix kdeplatformtheme_unittest after last commit

David Rosca nowrep at gmail.com
Fri Nov 6 10:37:08 UTC 2015



> On Oct. 29, 2015, 8:26 p.m., Aleix Pol Gonzalez wrote:
> > autotests/kdeplatformtheme_unittest.cpp, line 237
> > <https://git.reviewboard.kde.org/r/125877/diff/1/?file=413361#file413361line237>
> >
> >     What does `qApp->wheelScrollLines()` return now?
> 
> David Rosca wrote:
>     It returned the value I have set in mouse kcm, because the test KdePlatformTheme is not installed to qApp (and WheelScrollLines is now set as themeHint instead of directly calling qApp->setWheelScrollLines)
> 
> Aleix Pol Gonzalez wrote:
>     So the behavior on all applications that used qApp->wheelScrollLines() changed now?
> 
> David Rosca wrote:
>     No, it just can't be set with QApplication::setWheelScrollLines (from KdePlatformTheme constructor) because QApplication is querying QPlatformTheme for the value. 
>     
>     That is with Qt 5.5, older version didn't have the WheelScrollLines hint.
> 
> Marco Martin wrote:
>     if QApplication is querying QPlatformTheme for wheelScrollLines(), why do you have to use themeHint directly?
> 
> David Rosca wrote:
>     Because that's what this autotest is doing (see how the other themeHints are tested above). It just tests if the KdePlatformTheme correctly gets the value from config.
> 
> David Faure wrote:
>     So why not test both, i.e. turn #else into #endif?

Because the platform theme used by QTest QApplication is created before prepareEnvironment() is called, thus it uses the user's kdeglobals and not the one used by tests.

If we fix it, eg with:

```
int main(int argc, char *argv[])
{
    prepareEnvironment();
    qputenv("QT_QPA_PLATFORMTHEME", QByteArrayLiteral("kde"));
    QApplication app(argc, argv);
    KdePlatformTheme_UnitTest t;
    return QTest::qExec(&t, argc, argv);
}
```

instead of using Q_COREAPP_STARTUP_FUNCTION, then we can test the QApplication directly (not only wheelScrollLines, but every other hints).

I can rewrite the test according to this, if it's fine.


- David


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/125877/#review87695
-----------------------------------------------------------


On Oct. 29, 2015, 8:22 p.m., David Rosca wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/125877/
> -----------------------------------------------------------
> 
> (Updated Oct. 29, 2015, 8:22 p.m.)
> 
> 
> Review request for KDE Frameworks.
> 
> 
> Repository: frameworkintegration
> 
> 
> Description
> -------
> 
> see summary
> 
> 
> Diffs
> -----
> 
>   autotests/kdeplatformtheme_unittest.cpp f660ffd 
> 
> Diff: https://git.reviewboard.kde.org/r/125877/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> David Rosca
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20151106/5824149e/attachment.html>


More information about the Kde-frameworks-devel mailing list