Bug 360846 - perlqt: qtgui/t/helpcontextsensitivehelp.t tests fail
Summary: perlqt: qtgui/t/helpcontextsensitivehelp.t tests fail
Status: RESOLVED FIXED
Alias: None
Product: bindings
Classification: Unmaintained
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kde-bindings
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-22 11:26 UTC by Petr Pisar
Modified: 2016-10-04 08:18 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Pisar 2016-03-22 11:26:51 UTC
qtgui/t/helpcontextsensitivehelp.t tests fail like this:

$ xvfb-run -a "prove" -v -b -I qtgui/examples/help/contextsensitivehelp qtgui/t/helpcontextsensitivehelp.t
qtgui/t/helpcontextsensitivehelp.t ..
1..10
********* Start testing of HelpContextSensitiveHelpTest *********
Config: Using QTest library 4.8.7, Qt 4.8.7
ok 1 - Window shown
PASS   : HelpContextSensitiveHelpTest::initTestCase()
not ok 2 - Help message update plantComboBox

#   Failed test 'Help message update plantComboBox'
#   at qtgui/t/helpcontextsensitivehelp.t line 87.
#          got: ''
#     expected: 'Different kind of plants need different amounts of water. Here's a short overview over the most common grown plants and their avarage need of water:
#
# Kind
# Amount
# Squash
# 2000
# Bean
# 1500
# Carrot
# 1200
# Strawberry
# 1300
# Raspberry
# 1000
# Blueberry
# 1100
#
#
# Warning: Watering them too much or too little will cause irreversible damage! '

All tests for the 9 widgets fail the same way: the obtained text is empty instead of the expected test.

I can see the failure with latest master git code as well as 0.96.0 version from CPAN.

Reproducible: Always
Comment 1 Petr Pisar 2016-03-22 11:32:32 UTC
By the way qtgui/t/mainwindowsmdi.t fails too:

$ xvfb-run -a "prove" -v -I/home/test/fedora/perl-Qt/Qt-0.96.0/build/blib/{arch,lib} "/home/test/fedora/perl-Qt/Qt-0.96.0/qtgui/t/mainwindowsmdi.t"
/home/test/fedora/perl-Qt/Qt-0.96.0/qtgui/t/mainwindowsmdi.t .. 
1..5
********* Start testing of MainWindowsMDITest *********
Config: Using QTest library 4.8.7, Qt 4.8.7
PASS   : MainWindowsMDITest::initTestCase()
ok 1 - File write contents
PASS   : MainWindowsMDITest::testSave()
ok 2 - Widget focus
ok 3 - Widget focus
not ok 4 - Widget focus

#   Failed test 'Widget focus'
#   at /home/test/fedora/perl-Qt/Qt-0.96.0/qtgui/t/mainwindowsmdi.t line 73.
#          got: ' MdiChild=HASH(0x24c5b80)'
#     expected: ' MdiChild=HASH(0x24cb650)'
ok 5 - Widget focus
PASS   : MainWindowsMDITest::testFocus()
PASS   : MainWindowsMDITest::cleanupTestCase()
Totals: 4 passed, 0 failed, 0 skipped
********* Finished testing of MainWindowsMDITest *********
# Looks like you failed 1 test of 5.
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/5 subtests 

Both tests work with focus. Maybe something is fishy with the focus.
Comment 2 Chris Burel 2016-10-03 21:50:18 UTC
I can't replicate the failure with the helpcontextsensitivehelp test, but I can replicate the mainwindowsmdi test failure.  This is fixed in c989a56d.

The problem was in PerlQt's method resolution.  When there are method overloads, it is supposed to determine the best method to call based on the inheritance distance between the types of the arguments supplied, and the method overloads.  Specifically, consider the following two overloads:
QSignalMapper::setMapping(QObject* sender, QWidget* widget)
QSignalMapper::setMapping(QObject* sender, QObject* object)

Calling $mapper->setMapping($myObject, $myWidget) should resolve to the first one, not the second.

There were two problems.  First, the function that was designed to return the inheritance distance was only returning 1 or -1, indicating a yes or no respectively.  This is fixed in 3a22e526.
The second problem was that even after the inheritance depth was returned correctly, the precedence order of the methods was being lost.  This is fixed in 0b2b3da3.

http://commits.kde.org/perlqt/c989a56da7d887feabed9d2875550173c2ceabcb
Comment 3 Petr Pisar 2016-10-04 08:18:12 UTC
Thank you for the fixes. Now both the tests pass for me.