Adapt clementine tests to qt5
This commit is contained in:
parent
8bafaced14
commit
32fe732f64
|
@ -35,7 +35,7 @@ endif (UNIX AND NOT APPLE)
|
|||
|
||||
set(QT_MIN_VERSION 5.0.0)
|
||||
|
||||
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Core OpenGL Sql Network Xml Widgets Concurrent)
|
||||
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Core OpenGL Sql Network Xml Widgets Concurrent Test)
|
||||
find_package(X11)
|
||||
if(X11_FOUND)
|
||||
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS X11Extras)
|
||||
|
|
|
@ -100,6 +100,7 @@ macro(add_test_file test_source gui_required)
|
|||
${test_source}
|
||||
)
|
||||
target_link_libraries(${TEST_NAME} ${GMOCK_LIBRARIES} clementine_lib test_utils)
|
||||
qt5_use_modules (${TEST_NAME} Test)
|
||||
set(GUI_REQUIRED ${gui_required})
|
||||
if (GUI_REQUIRED)
|
||||
target_link_libraries(${TEST_NAME} test_gui_main)
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#ifndef Q_WS_X11
|
||||
# include <QtPlugin>
|
||||
Q_IMPORT_PLUGIN(qsqlite)
|
||||
Q_IMPORT_PLUGIN(QSQLiteDriverPlugin)
|
||||
#endif
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "mock_networkaccessmanager.h"
|
||||
|
||||
#include <QtDebug>
|
||||
#include <QUrlQuery>
|
||||
|
||||
#include <algorithm>
|
||||
using std::min;
|
||||
|
@ -44,10 +45,11 @@ class RequestForUrlMatcher : public MatcherInterface<const QNetworkRequest&> {
|
|||
return false;
|
||||
}
|
||||
|
||||
QUrlQuery url_query(url);
|
||||
for (QMap<QString, QString>::const_iterator it = expected_params_.constBegin();
|
||||
it != expected_params_.constEnd(); ++it) {
|
||||
if (!url.hasQueryItem(it.key()) ||
|
||||
url.queryItemValue(it.key()) != it.value()) {
|
||||
if (!url_query.hasQueryItem(it.key()) ||
|
||||
url_query.queryItemValue(it.key()) != it.value()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ static const char kLongMultiByteString[] =
|
|||
|
||||
TEST(ZeroconfTest, TruncatesAscii) {
|
||||
QByteArray truncated = Zeroconf::TruncateName(
|
||||
QString::fromAscii(k64CharAscii));
|
||||
QString::fromLatin1(k64CharAscii));
|
||||
EXPECT_EQ(63, truncated.size());
|
||||
EXPECT_TRUE(truncated.endsWith('\0'));
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ TEST(ZeroconfTest, DoesNotTruncateShortMultiByteUTF8) {
|
|||
|
||||
TEST(ZeroconfTest, TruncatesLongMultiByteUTF8) {
|
||||
QByteArray truncated = Zeroconf::TruncateName(
|
||||
QString::fromAscii(kLongMultiByteString));
|
||||
QString::fromLatin1(kLongMultiByteString));
|
||||
EXPECT_LE(63, truncated.size());
|
||||
EXPECT_TRUE(truncated.endsWith('\0'));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue