mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-24 10:52:51 +00:00
libs: attach the signal spy after D-Bus initialization stuff happens in favicon test
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
8acb29cd9f
commit
5f6c75eee2
1 changed files with 14 additions and 9 deletions
|
@ -83,15 +83,15 @@ void FavIconTest::testSetIconForURL()
|
|||
if ( !checkNetworkAccess() )
|
||||
QSKIP( "no network access", SkipAll );
|
||||
|
||||
QSignalSpy spy( &m_favIconModule, SIGNAL(iconChanged(bool,QString,QString)) );
|
||||
QVERIFY( spy.isValid() );
|
||||
QCOMPARE( spy.count(), 0 );
|
||||
|
||||
{
|
||||
QEventLoop eventLoop;
|
||||
// The call to connect() triggers qdbus initialization stuff, while QSignalSpy doesn't...
|
||||
connect(&m_favIconModule, SIGNAL(iconChanged(bool,QString,QString)), &eventLoop, SLOT(quit()));
|
||||
|
||||
QSignalSpy spy( &m_favIconModule, SIGNAL(iconChanged(bool,QString,QString)) );
|
||||
QVERIFY( spy.isValid() );
|
||||
QCOMPARE( spy.count(), 0 );
|
||||
|
||||
m_favIconModule.setIconForUrl( QString( s_hostUrl ), QString( s_altIconUrl ) );
|
||||
|
||||
qDebug( "called first setIconForUrl, waiting" );
|
||||
|
@ -110,18 +110,23 @@ void FavIconTest::testSetIconForURL()
|
|||
QEventLoop eventLoop;
|
||||
// The call to connect() triggers qdbus initialization stuff, while QSignalSpy doesn't...
|
||||
connect(&m_favIconModule, SIGNAL(iconChanged(bool,QString,QString)), &eventLoop, SLOT(quit()));
|
||||
|
||||
QSignalSpy spy( &m_favIconModule, SIGNAL(iconChanged(bool,QString,QString)) );
|
||||
QVERIFY( spy.isValid() );
|
||||
QCOMPARE( spy.count(), 0 );
|
||||
|
||||
m_favIconModule.setIconForUrl( QString( s_hostUrl ), QString( s_iconUrl ) );
|
||||
|
||||
qDebug( "called setIconForUrl again, waiting" );
|
||||
if ( spy.count() < 2 ) {
|
||||
if ( spy.count() < 1 ) {
|
||||
QTimer::singleShot(10000, &eventLoop, SLOT(quit()));
|
||||
eventLoop.exec( QEventLoop::ExcludeUserInputEvents );
|
||||
}
|
||||
|
||||
QCOMPARE( spy.count(), 2 );
|
||||
QCOMPARE( spy[1][0].toBool(), false );
|
||||
QCOMPARE( spy[1][1].toString(), QString( s_hostUrl ) );
|
||||
QCOMPARE( spy[1][2].toString(), QString( "favicons/www.google.com" ) );
|
||||
QCOMPARE( spy.count(), 1 );
|
||||
QCOMPARE( spy[0][0].toBool(), false );
|
||||
QCOMPARE( spy[0][1].toString(), QString( s_hostUrl ) );
|
||||
QCOMPARE( spy[0][2].toString(), QString( "favicons/www.google.com" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue