equal
deleted
inserted
replaced
103 void tst_lconvert::doCompare(QIODevice *actualDev, const QString &expectedFn) |
103 void tst_lconvert::doCompare(QIODevice *actualDev, const QString &expectedFn) |
104 { |
104 { |
105 QList<QByteArray> actual = actualDev->readAll().split('\n'); |
105 QList<QByteArray> actual = actualDev->readAll().split('\n'); |
106 |
106 |
107 QFile file(expectedFn); |
107 QFile file(expectedFn); |
108 QVERIFY(file.open(QIODevice::ReadOnly)); |
108 QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); |
109 QList<QByteArray> expected = file.readAll().split('\n'); |
109 QList<QByteArray> expected = file.readAll().split('\n'); |
110 |
110 |
111 int i = 0, ei = expected.size(), gi = actual.size(); |
111 int i = 0, ei = expected.size(), gi = actual.size(); |
112 for (; ; i++) { |
112 for (; ; i++) { |
113 if (i == gi) { |
113 if (i == gi) { |
177 for (int i = 0; i < stations.size() - 1; i++) { |
177 for (int i = 0; i < stations.size() - 1; i++) { |
178 QStringList args; |
178 QStringList args; |
179 if (!argList.isEmpty()) |
179 if (!argList.isEmpty()) |
180 args += argList[i]; |
180 args += argList[i]; |
181 args << "-if" << stations[i] << "-i" << "-" << "-of" << stations[i + 1]; |
181 args << "-if" << stations[i] << "-i" << "-" << "-of" << stations[i + 1]; |
182 cvts.at(i)->start(binDir + "/lconvert", args); |
182 cvts.at(i)->start(binDir + "/lconvert", args, QIODevice::ReadWrite | QIODevice::Text); |
183 } |
183 } |
184 int st = 0; |
184 int st = 0; |
185 foreach (QProcess *cvt, cvts) |
185 foreach (QProcess *cvt, cvts) |
186 doWait(cvt, ++st); |
186 doWait(cvt, ++st); |
187 |
187 |
211 QTest::newRow("kde multiline") << "test-kde-multiline.po" << "po"; |
211 QTest::newRow("kde multiline") << "test-kde-multiline.po" << "po"; |
212 QTest::newRow("po linewrapping") << "wrapping.po" << "po"; |
212 QTest::newRow("po linewrapping") << "wrapping.po" << "po"; |
213 QTest::newRow("relative locations") << "relative.ts" << "ts"; |
213 QTest::newRow("relative locations") << "relative.ts" << "ts"; |
214 QTest::newRow("message ids") << "msgid.ts" << "ts"; |
214 QTest::newRow("message ids") << "msgid.ts" << "ts"; |
215 QTest::newRow("length variants") << "variants.ts" << "ts"; |
215 QTest::newRow("length variants") << "variants.ts" << "ts"; |
|
216 QTest::newRow("qph") << "phrasebook.qph" << "qph"; |
216 } |
217 } |
217 |
218 |
218 void tst_lconvert::readverifies() |
219 void tst_lconvert::readverifies() |
219 { |
220 { |
220 QFETCH(QString, fileName); |
221 QFETCH(QString, fileName); |
241 QFETCH(QString, format); |
242 QFETCH(QString, format); |
242 |
243 |
243 QString outFileNameFq = dataDir + outFileName; |
244 QString outFileNameFq = dataDir + outFileName; |
244 |
245 |
245 QProcess cvt; |
246 QProcess cvt; |
246 cvt.start(binDir + "/lconvert", QStringList() << "-i" << (dataDir + inFileName) << "-of" << format); |
247 cvt.start(binDir + "/lconvert", |
|
248 QStringList() << "-i" << (dataDir + inFileName) << "-of" << format, |
|
249 QIODevice::ReadWrite | QIODevice::Text); |
247 doWait(&cvt, 0); |
250 doWait(&cvt, 0); |
248 if (QTest::currentTestFailed()) |
251 if (QTest::currentTestFailed()) |
249 return; |
252 return; |
250 |
253 |
251 doCompare(&cvt, outFileNameFq); |
254 doCompare(&cvt, outFileNameFq); |