[libcalamares] Handle multiple invalid URLs at once

- expand tests with example where more than one URL is invalid
- fix the call to the wrong overload of QVector::erase()
main
Adriaan de Groot 4 years ago
parent 653359d815
commit 0538881447

@ -222,7 +222,7 @@ Manager::setCheckHasInternetUrl( const QVector< QUrl >& urls )
d->m_hasInternetUrls.begin(), d->m_hasInternetUrls.end(), []( const QUrl& u ) { return !u.isValid(); } );
if ( it != d->m_hasInternetUrls.end() )
{
d->m_hasInternetUrls.erase( it );
d->m_hasInternetUrls.erase( it, d->m_hasInternetUrls.end() );
}
}

@ -134,4 +134,14 @@ NetworkTests::testCheckMultiUrl()
QVERIFY( nam.checkHasInternet() );
QCOMPARE( nam.getCheckInternetUrls().count(), 2 );
}
{
QUrl u0( "http://nonexistent.example.com" );
QUrl u1;
QVERIFY( u0.isValid() );
QVERIFY( !u1.isValid() );
nam.setCheckHasInternetUrl( { u1, u1, u1, u1 } );
QCOMPARE( nam.getCheckInternetUrls().count(), 0 );
nam.setCheckHasInternetUrl( { u1, u1, u0, u1 } );
QCOMPARE( nam.getCheckInternetUrls().count(), 1 );
}
}

Loading…
Cancel
Save