Fix -Wunused-result warnings in tests
Existing ones, as well as the newly-popping up ones from QFile::open(). Pick-to: 6.9 6.8 Change-Id: I580f3a022c18bc9026e47df10da8cc7b78296366 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
c1a18d3edf
commit
ec0f58f5cf
@ -67,7 +67,7 @@ void tst_datadevicev1::pasteAscii()
|
|||||||
auto *offer = dataDevice()->sendDataOffer(client, {"text/plain"});
|
auto *offer = dataDevice()->sendDataOffer(client, {"text/plain"});
|
||||||
connect(offer, &DataOffer::receive, offer, [](QString mimeType, int fd) {
|
connect(offer, &DataOffer::receive, offer, [](QString mimeType, int fd) {
|
||||||
QFile file;
|
QFile file;
|
||||||
file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle);
|
QVERIFY(file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle));
|
||||||
QCOMPARE(mimeType, "text/plain");
|
QCOMPARE(mimeType, "text/plain");
|
||||||
file.write(QByteArray("normal ascii"));
|
file.write(QByteArray("normal ascii"));
|
||||||
file.close();
|
file.close();
|
||||||
@ -105,7 +105,7 @@ void tst_datadevicev1::pasteUtf8()
|
|||||||
auto *offer = dataDevice()->sendDataOffer(client, {"text/plain", "text/plain;charset=utf-8"});
|
auto *offer = dataDevice()->sendDataOffer(client, {"text/plain", "text/plain;charset=utf-8"});
|
||||||
connect(offer, &DataOffer::receive, offer, [](QString mimeType, int fd) {
|
connect(offer, &DataOffer::receive, offer, [](QString mimeType, int fd) {
|
||||||
QFile file;
|
QFile file;
|
||||||
file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle);
|
QVERIFY(file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle));
|
||||||
QCOMPARE(mimeType, "text/plain;charset=utf-8");
|
QCOMPARE(mimeType, "text/plain;charset=utf-8");
|
||||||
file.write(QByteArray("face with tears of joy: 😂"));
|
file.write(QByteArray("face with tears of joy: 😂"));
|
||||||
file.close();
|
file.close();
|
||||||
@ -143,7 +143,7 @@ void tst_datadevicev1::pasteMozUrl()
|
|||||||
auto *offer = dataDevice()->sendDataOffer(client, {"text/x-moz-url"});
|
auto *offer = dataDevice()->sendDataOffer(client, {"text/x-moz-url"});
|
||||||
connect(offer, &DataOffer::receive, offer, [](QString mimeType, int fd) {
|
connect(offer, &DataOffer::receive, offer, [](QString mimeType, int fd) {
|
||||||
QFile file;
|
QFile file;
|
||||||
file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle);
|
QVERIFY(file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle));
|
||||||
QCOMPARE(mimeType, "text/x-moz-url");
|
QCOMPARE(mimeType, "text/x-moz-url");
|
||||||
const QString content("https://www.qt.io/\nQt\nhttps://www.example.com/\nExample Website");
|
const QString content("https://www.qt.io/\nQt\nhttps://www.example.com/\nExample Website");
|
||||||
// Need UTF-16.
|
// Need UTF-16.
|
||||||
@ -186,7 +186,7 @@ void tst_datadevicev1::pasteSingleUtf8MozUrl()
|
|||||||
auto *offer = dataDevice()->sendDataOffer(client, {"text/x-moz-url"});
|
auto *offer = dataDevice()->sendDataOffer(client, {"text/x-moz-url"});
|
||||||
connect(offer, &DataOffer::receive, offer, [](QString mimeType, int fd) {
|
connect(offer, &DataOffer::receive, offer, [](QString mimeType, int fd) {
|
||||||
QFile file;
|
QFile file;
|
||||||
file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle);
|
QVERIFY(file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle));
|
||||||
QCOMPARE(mimeType, "text/x-moz-url");
|
QCOMPARE(mimeType, "text/x-moz-url");
|
||||||
const QString content("https://www.qt.io/");
|
const QString content("https://www.qt.io/");
|
||||||
file.write(content.toUtf8());
|
file.write(content.toUtf8());
|
||||||
|
@ -83,8 +83,7 @@ protected:
|
|||||||
|
|
||||||
if (fds[1].revents & POLLIN) {
|
if (fds[1].revents & POLLIN) {
|
||||||
char pipeIn;
|
char pipeIn;
|
||||||
read(m_pipefd[0], &pipeIn, 1);
|
if (read(m_pipefd[0], &pipeIn, 1) == 1 && pipeIn == 'q')
|
||||||
if (pipeIn == 'q')
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -292,7 +292,7 @@ void tst_primaryselectionv1::pasteAscii()
|
|||||||
auto *offer = device->sendDataOffer({"text/plain"});
|
auto *offer = device->sendDataOffer({"text/plain"});
|
||||||
connect(offer, &PrimarySelectionOfferV1::receive, offer, [](QString mimeType, int fd) {
|
connect(offer, &PrimarySelectionOfferV1::receive, offer, [](QString mimeType, int fd) {
|
||||||
QFile file;
|
QFile file;
|
||||||
file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle);
|
QVERIFY(file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle));
|
||||||
QCOMPARE(mimeType, "text/plain");
|
QCOMPARE(mimeType, "text/plain");
|
||||||
file.write(QByteArray("normal ascii"));
|
file.write(QByteArray("normal ascii"));
|
||||||
file.close();
|
file.close();
|
||||||
@ -338,7 +338,7 @@ void tst_primaryselectionv1::pasteUtf8()
|
|||||||
auto *offer = device->sendDataOffer({"text/plain", "text/plain;charset=utf-8"});
|
auto *offer = device->sendDataOffer({"text/plain", "text/plain;charset=utf-8"});
|
||||||
connect(offer, &PrimarySelectionOfferV1::receive, offer, [](QString mimeType, int fd) {
|
connect(offer, &PrimarySelectionOfferV1::receive, offer, [](QString mimeType, int fd) {
|
||||||
QFile file;
|
QFile file;
|
||||||
file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle);
|
QVERIFY(file.open(fd, QIODevice::WriteOnly, QFile::FileHandleFlag::AutoCloseHandle));
|
||||||
QCOMPARE(mimeType, "text/plain;charset=utf-8");
|
QCOMPARE(mimeType, "text/plain;charset=utf-8");
|
||||||
file.write(QByteArray("face with tears of joy: 😂"));
|
file.write(QByteArray("face with tears of joy: 😂"));
|
||||||
file.close();
|
file.close();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user