mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Ref T682 Don't convert text codec name to lower case, as it is case sensitive.
This commit is contained in:
@@ -37,7 +37,7 @@ namespace BlackGui
|
||||
CFsdSetup CFsdSetupForm::getValue() const
|
||||
{
|
||||
if (!this->isEnabled()) { return this->getDisabledValue(); }
|
||||
CFsdSetup s(ui->le_TextCodec->text().trimmed().toLower());
|
||||
CFsdSetup s(ui->le_TextCodec->text().trimmed());
|
||||
s.setSendReceiveDetails(
|
||||
ui->cb_AircraftPartsSend->isChecked(), ui->cb_AircraftPartsReceive->isChecked(),
|
||||
ui->cb_GndFlagSend->isChecked(), ui->cb_GndFlagReceive->isChecked(),
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace BlackMisc
|
||||
const QString &getTextCodec() const { return m_textCodec; }
|
||||
|
||||
//! Set codec
|
||||
void setTextCodec(const QString &codec) { m_textCodec = codec.trimmed().toLower(); }
|
||||
void setTextCodec(const QString &codec) { m_textCodec = codec.trimmed(); }
|
||||
|
||||
//! Get send / receive details
|
||||
SendReceiveDetails getSendReceiveDetails() const;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <QTest>
|
||||
#include <QTime>
|
||||
#include <QTextCodec>
|
||||
|
||||
using namespace BlackMisc;
|
||||
|
||||
@@ -34,6 +35,7 @@ namespace BlackMiscTest
|
||||
void testIndexOf();
|
||||
void testSplit();
|
||||
void testTimestampParsing();
|
||||
void testCodecs();
|
||||
};
|
||||
|
||||
void CTestStringUtils::testRemove()
|
||||
@@ -138,6 +140,23 @@ namespace BlackMiscTest
|
||||
qDebug() << "Parsing date/time, optimized" << elapsedOptimized << "vs. QDateTime: " << elapsedQt;
|
||||
QVERIFY2(elapsedOptimized < elapsedQt, "Expect optimized being faster as QDateTim::fromString");
|
||||
}
|
||||
|
||||
void CTestStringUtils::testCodecs()
|
||||
{
|
||||
QTextCodec *latin1 = QTextCodec::codecForName("latin1");
|
||||
QTextCodec *cp1251 = QTextCodec::codecForName("windows-1251");
|
||||
QTextCodec *utf8 = QTextCodec::codecForName("UTF-8");
|
||||
const QString testEnglish = QStringLiteral(u"test");
|
||||
const QString testRussian = QStringLiteral(u"тест");
|
||||
bool okEn1 = latin1->toUnicode(latin1->fromUnicode(testEnglish)) == testEnglish;
|
||||
bool okEn2 = utf8->toUnicode(utf8->fromUnicode(testEnglish)) == testEnglish;
|
||||
bool okRu1 = cp1251->toUnicode(cp1251->fromUnicode(testRussian)) == testRussian;
|
||||
bool okRu2 = utf8->toUnicode(utf8->fromUnicode(testRussian)) == testRussian;
|
||||
QVERIFY2(okEn1, "English \"test\" equal after round-trip with latin1");
|
||||
QVERIFY2(okEn2, "English \"test\" equal after round-trip with utf8");
|
||||
QVERIFY2(okRu1, "Russian \"test\" equal after round-trip with cp1251");
|
||||
QVERIFY2(okRu2, "Russian \"test\" equal after round-trip with utf8");
|
||||
}
|
||||
}
|
||||
|
||||
//! main
|
||||
|
||||
Reference in New Issue
Block a user