Merge "Merge remote-tracking branch 'origin/4.13' into 4.14" into 4.14

This commit is contained in:
The Qt Project
2020-10-08 09:58:48 +00:00
18 changed files with 128 additions and 151 deletions

View File

@@ -395,7 +395,7 @@ int TestResultModel::resultTypeCount(ResultType type) const
{
int result = 0;
for (const auto &id : m_reportedSummary.keys()) {
for (const auto &id : m_testResultCount.keys()) {
// if we got a result count from the framework prefer that over our counted results
int reported = m_reportedSummary[id].value(type);
result += reported != 0 ? reported : m_testResultCount.value(id).value(type);

View File

@@ -217,6 +217,8 @@ SwitchLanguageComboboxAction::SwitchLanguageComboboxAction(QObject *parent)
QWidget *SwitchLanguageComboboxAction::createWidget(QWidget *parent)
{
QPointer<QComboBox> comboBox = new QComboBox(parent);
// FIXME: this combobox does not work at the moment
comboBox->setDisabled(true);
const QString toolTip(tr("Switch the language used by preview."));
comboBox->setToolTip(toolTip);
comboBox->addItem(tr("Default"));

View File

@@ -36,24 +36,24 @@ QmlDebugTranslationClient::QmlDebugTranslationClient(QmlDebug::QmlDebugConnectio
{
}
void QmlDebugTranslationClient::changeLanguage(const QUrl &url, const QString &locale)
void QmlDebugTranslationClient::changeLanguage(const QUrl &url, const QString &localeIsoCode)
{
QmlDebug::QPacket packet(dataStreamVersion());
packet << static_cast<qint8>(ChangeLanguage) << url << locale;
packet << static_cast<qint8>(Command::ChangeLanguage) << url << localeIsoCode;
sendMessage(packet.data());
}
void QmlDebugTranslationClient::changeWarningColor(const QColor &warningColor)
{
QmlDebug::QPacket packet(dataStreamVersion());
packet << static_cast<qint8>(ChangeWarningColor) << warningColor;
packet << static_cast<qint8>(Command::ChangeWarningColor) << warningColor;
sendMessage(packet.data());
}
void QmlDebugTranslationClient::changeElidedTextWarningString(const QString &warningString)
{
QmlDebug::QPacket packet(dataStreamVersion());
packet << static_cast<qint8>(ChangeElidedTextWarningString) << warningString;
packet << static_cast<qint8>(Command::ChangeElidedTextWarningString) << warningString;
sendMessage(packet.data());
}
@@ -68,21 +68,21 @@ void QmlDebugTranslationClient::changeElideWarning(bool elideWarning)
void QmlDebugTranslationClient::setDebugTranslationServiceLogFile(const QString &logFilePath)
{
QmlDebug::QPacket packet(dataStreamVersion());
packet << static_cast<qint8>(SetDebugTranslationServiceLogFile) << logFilePath;
packet << static_cast<qint8>(Command::SetDebugTranslationServiceLogFile) << logFilePath;
sendMessage(packet.data());
}
void QmlDebugTranslationClient::enableElidedTextWarning()
{
QmlDebug::QPacket packet(dataStreamVersion());
packet << static_cast<qint8>(EnableElidedTextWarning);
packet << static_cast<qint8>(Command::EnableElidedTextWarning);
sendMessage(packet.data());
}
void QmlDebugTranslationClient::disableElidedTextWarning()
{
QmlDebug::QPacket packet(dataStreamVersion());
packet << static_cast<qint8>(DisableElidedTextWarning);
packet << static_cast<qint8>(Command::DisableElidedTextWarning);
sendMessage(packet.data());
}
@@ -91,7 +91,7 @@ void QmlDebugTranslationClient::messageReceived(const QByteArray &data)
QmlDebug::QPacket packet(dataStreamVersion(), data);
qint8 command;
packet >> command;
qDebug() << "invalid command" << command;
qDebug() << Q_FUNC_INFO << "invalid command" << command;
}
void QmlDebugTranslationClient::stateChanged(QmlDebug::QmlDebugClient::State state)

View File

@@ -35,19 +35,20 @@ class QMLPREVIEW_EXPORT QmlDebugTranslationClient : public QmlDebug::QmlDebugCli
Q_OBJECT
public:
//needs to be in sync with QQmlDebugTranslationClient in qtdeclarative/src/plugins/qmltooling/qmldbg_preview/qqmldebugtranslationservice.h
enum Command {
enum class Command {
ChangeLanguage,
MissingTranslationsChecked,
EnableElidedTextWarning,
DisableElidedTextWarning,
ChangeWarningColor,
ChangeElidedTextWarningString,
SetDebugTranslationServiceLogFile,
EnableElidedTextWarning,
DisableElidedTextWarning,
TestAllLanguages
};
explicit QmlDebugTranslationClient(QmlDebug::QmlDebugConnection *connection);
void changeLanguage(const QUrl &url, const QString &locale);
void changeLanguage(const QUrl &url, const QString &localeIsoCode);
void changeWarningColor(const QColor &warningColor);
void changeElidedTextWarningString(const QString &warningString); //is QByteArray better here?
void changeElideWarning(bool elideWarning);

View File

@@ -91,8 +91,9 @@ QObject *getPreviewPlugin()
namespace QmlPreview {
QmlDebugTranslationWidget::QmlDebugTranslationWidget(QWidget *parent)
QmlDebugTranslationWidget::QmlDebugTranslationWidget(QWidget *parent, TestLanguageGetter languagesGetterMethod)
: QWidget(parent)
, m_testLanguagesGetter(languagesGetterMethod)
{
auto mainLayout = new QVBoxLayout(this);
@@ -124,6 +125,7 @@ QmlDebugTranslationWidget::QmlDebugTranslationWidget(QWidget *parent)
layout()->addWidget(elideWarningCheckBox);
connect(elideWarningCheckBox, &QCheckBox::stateChanged, [this] (int state) {
m_elideWarning = (state == Qt::Checked);
});
auto controlLayout = new QHBoxLayout;
@@ -232,6 +234,7 @@ void QmlDebugTranslationWidget::updateStartupProjectTranslations()
void QmlDebugTranslationWidget::updateCurrentTranslations(ProjectExplorer::Project *project)
{
m_testLanguages.clear();
for (int i = m_selectLanguageLayout->count()-1; i >= 0; --i) {
auto layoutItem = m_selectLanguageLayout->takeAt(i);
delete layoutItem->widget();
@@ -244,28 +247,23 @@ void QmlDebugTranslationWidget::updateCurrentTranslations(ProjectExplorer::Proje
connect(multiLanguageAspect, &QmlProjectManager::QmlMultiLanguageAspect::changed,
this, &QmlDebugTranslationWidget::updateStartupProjectTranslations,
Qt::UniqueConnection);
auto languageLabel = new QLabel();
languageLabel->setText(tr("Select which language should be tested:"));
m_selectLanguageLayout->addWidget(languageLabel);
if (multiLanguageAspect->value()) {
m_selectLanguageLayout->addWidget(new QLabel(
tr("Current language is \'<b>%1</b>\' can be changed in the 'Translation' tab.")
.arg(multiLanguageAspect->currentLocale())));
m_testLanguages.clear();
m_testLanguages.append(multiLanguageAspect->currentLocale());
} else {
m_selectLanguageLayout->addWidget(new QLabel(tr("Select which language should be tested:")));
QString errorMessage;
for (auto language : project->availableQmlPreviewTranslations(&errorMessage)) {
auto languageCheckBox = new QCheckBox(language);
m_selectLanguageLayout->addWidget(languageCheckBox);
connect(languageCheckBox, &QCheckBox::stateChanged, [this, language] (int state) {
if (state == Qt::Checked)
m_testLanguages.append(language);
else
m_testLanguages.removeAll(language);
addLanguageCheckBoxes({multiLanguageAspect->currentLocale()});
if (m_testLanguagesGetter) {
auto addTestLanguages = new QPushButton(tr("Add Test Languages"));
m_selectLanguageLayout->addWidget(addTestLanguages);
connect(addTestLanguages, &QPushButton::clicked, [this]() {
addLanguageCheckBoxes(m_testLanguagesGetter());
});
languageCheckBox->setChecked(true);
}
m_selectLanguageLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
} else {
QString errorMessage;
addLanguageCheckBoxes(project->availableQmlPreviewTranslations(&errorMessage));
}
m_selectLanguageLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
}
}
@@ -298,14 +296,16 @@ void QmlDebugTranslationWidget::runTest()
int timerCounter = 1;
const auto testLanguageList = m_testLanguages;
if (m_elideWarning)
previewPlugin->changeElideWarning(true);
auto testLanguages = [previewPlugin, runControl, testLanguageList](int timerCounter, const QString &previewedFile) {
qDebug() << "testLanguages" << previewedFile;
for (auto language : testLanguageList) {
QTimer::singleShot(timerCounter * 1000, previewPlugin, [previewPlugin, runControl, language, previewedFile]() {
if (runControl && runControl->isRunning()) {
if (!previewedFile.isEmpty())
previewPlugin->setPreviewedFile(previewedFile);
previewPlugin->setLocale(language);
previewPlugin->setLocaleIsoCode(language);
}
});
}
@@ -319,7 +319,7 @@ void QmlDebugTranslationWidget::runTest()
//delete m_currentRunControl; // who deletes the runcontrol?
m_currentRunControl = nullptr;
if (auto previewPlugin = qobject_cast<Internal::QmlPreviewPlugin*>(getPreviewPlugin()))
previewPlugin->setLocale(m_lastUsedLanguageBeforeTest);
previewPlugin->setLocaleIsoCode(m_lastUsedLanguageBeforeTest);
});
connect(runControl, &ProjectExplorer::RunControl::appendMessage,
@@ -332,7 +332,7 @@ void QmlDebugTranslationWidget::runTest()
if (auto runConfiguration = target->activeRunConfiguration()) {
runControl->setRunConfiguration(runConfiguration);
if (runControl->createMainWorker()) {
previewPlugin->setLocale(QString());
previewPlugin->setLocaleIsoCode(QString());
runControl->initiateStart();
}
}
@@ -399,7 +399,7 @@ void QmlDebugTranslationWidget::appendMessage(const QString &message, Utils::Out
return;
}
const QString serviceSeperator = ": QQmlDebugTranslationService: ";
if (!message.contains(serviceSeperator) || message.contains("DebugTranslation service - language changed"))
if (!message.contains(serviceSeperator))
return;
QString locationString = message;
locationString = locationString.split(serviceSeperator).first();
@@ -449,4 +449,19 @@ QString QmlDebugTranslationWidget::runButtonText(bool isRunning)
return tr("Run language tests");
}
void QmlDebugTranslationWidget::addLanguageCheckBoxes(const QStringList &languages)
{
for (auto language : languages) {
auto languageCheckBox = new QCheckBox(language);
m_selectLanguageLayout->addWidget(languageCheckBox);
connect(languageCheckBox, &QCheckBox::stateChanged, [this, language] (int state) {
if (state == Qt::Checked)
m_testLanguages.append(language);
else
m_testLanguages.removeAll(language);
});
languageCheckBox->setChecked(true);
}
}
} // namespace QmlPreview

View File

@@ -51,11 +51,13 @@ namespace QmlPreview {
class ProjectFileSelectionsWidget;
class QMLPREVIEW_EXPORT QmlDebugTranslationWidget : public QWidget
{
using TestLanguageGetter = std::function<QStringList()>;
Q_OBJECT
public:
explicit QmlDebugTranslationWidget(QWidget *parent = nullptr);
explicit QmlDebugTranslationWidget(QWidget *parent = nullptr, TestLanguageGetter languagesGetterMethod = {});
~QmlDebugTranslationWidget() override;
void setCurrentFile(const Utils::FilePath &filepath);
@@ -75,6 +77,7 @@ private:
QString singleFileButtonText(const QString &filePath);
QString runButtonText(bool isRunning = false);
void addLanguageCheckBoxes(const QStringList &languages);
QStringList m_testLanguages;
QString m_lastUsedLanguageBeforeTest;
@@ -94,6 +97,7 @@ private:
QString m_lastDir;
QHBoxLayout *m_selectLanguageLayout;
TestLanguageGetter m_testLanguagesGetter;
};
} // namespace QmlPreview

View File

@@ -56,13 +56,6 @@ void QmlPreviewClient::zoom(float zoomFactor)
sendMessage(packet.data());
}
void QmlPreviewClient::language(const QUrl &context, const QString &locale)
{
QmlDebug::QPacket packet(dataStreamVersion());
packet << static_cast<qint8>(Language) << context << locale;
sendMessage(packet.data());
}
void QmlPreviewClient::announceFile(const QString &path, const QByteArray &contents)
{
QmlDebug::QPacket packet(dataStreamVersion());

View File

@@ -43,8 +43,7 @@ public:
Directory,
ClearCache,
Zoom,
Fps,
Language
Fps
};
struct FpsInfo {
@@ -64,7 +63,6 @@ public:
void loadUrl(const QUrl &url);
void rerun();
void zoom(float zoomFactor);
void language(const QUrl &context, const QString &locale);
void announceFile(const QString &path, const QByteArray &contents);
void announceDirectory(const QString &path, const QStringList &entries);
void announceError(const QString &path);

View File

@@ -36,16 +36,14 @@
namespace QmlPreview {
namespace Internal {
QmlPreviewConnectionManager::~QmlPreviewConnectionManager()
{
}
QmlPreviewConnectionManager::QmlPreviewConnectionManager(QObject *parent) :
QmlDebug::QmlDebugConnectionManager(parent)
{
setTarget(nullptr);
}
QmlPreviewConnectionManager::~QmlPreviewConnectionManager() = default;
void QmlPreviewConnectionManager::setTarget(ProjectExplorer::Target *target)
{
QtSupport::BaseQtVersion::populateQmlFileFinder(&m_projectFileFinder, target);
@@ -117,13 +115,11 @@ void QmlPreviewConnectionManager::createDebugTranslationClient()
{
m_qmlDebugTranslationClient = new QmlDebugTranslationClient(connection());
connect(this, &QmlPreviewConnectionManager::language,
m_qmlDebugTranslationClient.data(), [this](const QString &locale) {
if (m_lastLoadedUrl.isEmpty()) {
// findValidI18nDirectoryAsUrl does not work if we didn't load any file
m_initLocale = locale;
} else {
// service expects a context URL.
m_qmlDebugTranslationClient, [this](const QString &locale) {
m_lastUsedLanguage = locale;
// findValidI18nDirectoryAsUrl does not work if we didn't load any file
// service expects a context URL.
if (!m_lastLoadedUrl.isEmpty()) {
// Search the parent directories of the last loaded URL for i18n files.
m_qmlDebugTranslationClient->changeLanguage(findValidI18nDirectoryAsUrl(locale), locale);
}
@@ -159,10 +155,9 @@ void QmlPreviewConnectionManager::createPreviewClient()
m_lastLoadedUrl = m_targetFileFinder.findUrl(filename);
m_qmlPreviewClient->loadUrl(m_lastLoadedUrl);
if (!m_initLocale.isEmpty()) {
emit language(m_initLocale);
m_initLocale.clear();
}
// emit language after a file was loaded and do it every time,
// because this also triggers the check for missing translations
emit language(m_lastUsedLanguage);
});
connect(this, &QmlPreviewConnectionManager::rerun,
@@ -171,19 +166,6 @@ void QmlPreviewConnectionManager::createPreviewClient()
connect(this, &QmlPreviewConnectionManager::zoom,
m_qmlPreviewClient.data(), &QmlPreviewClient::zoom);
connect(this, &QmlPreviewConnectionManager::language,
m_qmlPreviewClient.data(), [this](const QString &locale) {
if (m_lastLoadedUrl.isEmpty()) {
// findValidI18nDirectoryAsUrl does not work if we didn't load any file
m_initLocale = locale;
} else {
// service expects a context URL.
// Search the parent directories of the last loaded URL for i18n files.
m_qmlPreviewClient->language(findValidI18nDirectoryAsUrl(locale), locale);
}
});
connect(m_qmlPreviewClient.data(), &QmlPreviewClient::pathRequested,
this, [this](const QString &path) {
const bool found = m_projectFileFinder.findFileOrDirectory(

View File

@@ -76,10 +76,10 @@ private:
QPointer<QmlDebugTranslationClient> m_qmlDebugTranslationClient;
Utils::FileSystemWatcher m_fileSystemWatcher;
QUrl m_lastLoadedUrl;
QString m_lastUsedLanguage;
QmlPreviewFileLoader m_fileLoader = nullptr;
QmlPreviewFileClassifier m_fileClassifier = nullptr;
QmlPreviewFpsHandler m_fpsHandler = nullptr;
QString m_initLocale;
};
} // namespace Internal

View File

@@ -150,8 +150,8 @@ public:
QmlPreview::QmlPreviewFileClassifier m_fileClassifer = nullptr;
float m_zoomFactor = -1.0;
QmlPreview::QmlPreviewFpsHandler m_fpsHandler = nullptr;
QString m_locale;
bool elideWarning = false;
QString m_localeIsoCode;
bool m_translationElideWarning = false;
QPointer<QmlDebugTranslationWidget> m_qmlDebugTranslationWidget;
RunWorkerFactory localRunWorkerFactory{
@@ -163,8 +163,15 @@ public:
RunWorkerFactory runWorkerFactory{
[this](RunControl *runControl) {
QmlPreviewRunner *runner = new QmlPreviewRunner(runControl, m_fileLoader, m_fileClassifer,
m_fpsHandler, m_zoomFactor);
QmlPreviewRunner *runner = new QmlPreviewRunner(QmlPreviewRunnerSetting{
runControl,
m_fileLoader,
m_fileClassifer,
m_fpsHandler,
m_zoomFactor,
m_localeIsoCode,
m_translationElideWarning
});
connect(q, &QmlPreviewPlugin::updatePreviews,
runner, &QmlPreviewRunner::loadFile);
connect(q, &QmlPreviewPlugin::rerunPreviews,
@@ -173,7 +180,7 @@ public:
this, &QmlPreviewPluginPrivate::previewCurrentFile);
connect(q, &QmlPreviewPlugin::zoomFactorChanged,
runner, &QmlPreviewRunner::zoom);
connect(q, &QmlPreviewPlugin::localeChanged,
connect(q, &QmlPreviewPlugin::localeIsoCodeChanged,
runner, &QmlPreviewRunner::language);
connect(q, &QmlPreviewPlugin::elideWarningChanged,
runner, &QmlPreviewRunner::changeElideWarning);
@@ -207,7 +214,7 @@ QmlPreviewPluginPrivate::QmlPreviewPluginPrivate(QmlPreviewPlugin *parent)
&QAction::setEnabled);
connect(action, &QAction::triggered, this, [this]() {
if (auto multiLanguageAspect = QmlProjectManager::QmlMultiLanguageAspect::current())
m_locale = multiLanguageAspect->currentLocale();
m_localeIsoCode = multiLanguageAspect->currentLocale();
ProjectExplorerPlugin::runStartupProject(Constants::QML_PREVIEW_RUN_MODE);
});
@@ -387,30 +394,31 @@ void QmlPreviewPlugin::setFpsHandler(QmlPreviewFpsHandler fpsHandler)
emit fpsHandlerChanged(d->m_fpsHandler);
}
QString QmlPreviewPlugin::locale() const
QString QmlPreviewPlugin::localeIsoCode() const
{
return d->m_locale;
return d->m_localeIsoCode;
}
void QmlPreviewPlugin::setLocale(const QString &locale)
void QmlPreviewPlugin::setLocaleIsoCode(const QString &localeIsoCode)
{
if (auto multiLanguageAspect = QmlProjectManager::QmlMultiLanguageAspect::current())
multiLanguageAspect->setCurrentLocale(locale);
if (d->m_locale == locale)
multiLanguageAspect->setCurrentLocale(localeIsoCode);
if (d->m_localeIsoCode == localeIsoCode)
return;
d->m_locale = locale;
emit localeChanged(d->m_locale);
d->m_localeIsoCode = localeIsoCode;
emit localeIsoCodeChanged(d->m_localeIsoCode);
}
bool QmlPreviewPlugin::elideWarning() const
{
return d->elideWarning;
return d->m_translationElideWarning;
}
void QmlPreviewPlugin::changeElideWarning(bool elideWarning)
{
d->elideWarning = elideWarning;
d->m_translationElideWarning = elideWarning;
emit elideWarningChanged(elideWarning);
}
void QmlPreviewPlugin::setFileLoader(QmlPreviewFileLoader fileLoader)

View File

@@ -58,7 +58,7 @@ class QmlPreviewPlugin : public ExtensionSystem::IPlugin
Q_PROPERTY(QmlPreview::QmlPreviewFpsHandler fpsHandler READ fpsHandler
WRITE setFpsHandler NOTIFY fpsHandlerChanged)
Q_PROPERTY(float zoomFactor READ zoomFactor WRITE setZoomFactor NOTIFY zoomFactorChanged)
Q_PROPERTY(QString locale READ locale WRITE setLocale NOTIFY localeChanged)
Q_PROPERTY(QString localeIsoCode READ localeIsoCode WRITE setLocaleIsoCode NOTIFY localeIsoCodeChanged)
Q_PROPERTY(bool elideWarning READ elideWarning WRITE changeElideWarning NOTIFY elideWarningChanged)
public:
@@ -84,8 +84,8 @@ public:
QmlPreview::QmlPreviewFpsHandler fpsHandler() const;
void setFpsHandler(QmlPreview::QmlPreviewFpsHandler fpsHandler);
QString locale() const;
void setLocale(const QString &locale);
QString localeIsoCode() const;
void setLocaleIsoCode(const QString &localeIsoCode);
bool elideWarning() const;
void changeElideWarning(bool elideWarning);
@@ -103,7 +103,7 @@ signals:
void fpsHandlerChanged(QmlPreview::QmlPreviewFpsHandler fpsHandler);
void zoomFactorChanged(float zoomFactor);
void localeChanged(const QString &locale);
void localeIsoCodeChanged(const QString &localeIsoCode);
void elideWarningChanged(bool elideWarning);
private:

View File

@@ -45,17 +45,13 @@ namespace QmlPreview {
static const QString QmlServerUrl = "QmlServerUrl";
QmlPreviewRunner::QmlPreviewRunner(ProjectExplorer::RunControl *runControl,
QmlPreviewFileLoader fileLoader,
QmlPreviewFileClassifier fileClassifier,
QmlPreviewFpsHandler fpsHandler,
float initialZoom)
: RunWorker(runControl)
QmlPreviewRunner::QmlPreviewRunner(const QmlPreviewRunnerSetting &settings)
: RunWorker(settings.runControl)
{
setId("QmlPreviewRunner");
m_connectionManager.setFileLoader(fileLoader);
m_connectionManager.setFileClassifier(fileClassifier);
m_connectionManager.setFpsHandler(fpsHandler);
m_connectionManager.setFileLoader(settings.fileLoader);
m_connectionManager.setFileClassifier(settings.fileClassifier);
m_connectionManager.setFpsHandler(settings.fpsHandler);
connect(this, &QmlPreviewRunner::loadFile,
&m_connectionManager, &Internal::QmlPreviewConnectionManager::loadFile);
@@ -70,24 +66,29 @@ QmlPreviewRunner::QmlPreviewRunner(ProjectExplorer::RunControl *runControl,
&m_connectionManager, &Internal::QmlPreviewConnectionManager::changeElideWarning);
connect(&m_connectionManager, &Internal::QmlPreviewConnectionManager::connectionOpened,
this, [this, initialZoom]() {
if (initialZoom > 0)
emit zoom(initialZoom);
this, [this, settings]() {
if (settings.zoom > 0)
emit zoom(settings.zoom);
if (!settings.language.isEmpty())
emit language(settings.language);
if (settings.translationElideWarning)
emit changeElideWarning(true);
emit ready();
});
connect(&m_connectionManager, &Internal::QmlPreviewConnectionManager::restart,
runControl, [this, runControl]() {
if (!runControl->isRunning())
runControl(), [this]() {
if (!runControl()->isRunning())
return;
this->connect(runControl, &ProjectExplorer::RunControl::stopped, runControl, [runControl]() {
this->connect(runControl(), &ProjectExplorer::RunControl::stopped, [this]() {
ProjectExplorer::ProjectExplorerPlugin::runRunConfiguration(
runControl->runConfiguration(),
runControl()->runConfiguration(),
ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE, true);
});
runControl->initiateStop();
runControl()->initiateStop();
});
}

View File

@@ -32,14 +32,22 @@
namespace QmlPreview {
struct QmlPreviewRunnerSetting {
ProjectExplorer::RunControl *runControl = nullptr;
QmlPreviewFileLoader fileLoader;
QmlPreviewFileClassifier fileClassifier;
QmlPreviewFpsHandler fpsHandler;
float zoom = 1.0;
QString language;
bool translationElideWarning = false;
};
class QmlPreviewRunner : public ProjectExplorer::RunWorker
{
Q_OBJECT
public:
QmlPreviewRunner(ProjectExplorer::RunControl *runControl, QmlPreviewFileLoader fileLoader,
QmlPreviewFileClassifier fileClassifier, QmlPreviewFpsHandler fpsHandler,
float initialZoom);
QmlPreviewRunner(const QmlPreviewRunnerSetting &settings);
void setServerUrl(const QUrl &serverUrl);
QUrl serverUrl() const;

View File

@@ -91,24 +91,6 @@ void QmlPreviewClientTest::testZoom()
QVERIFY(packet.atEnd());
}
void QmlPreviewClientTest::testLanguate()
{
TestableQmlPreviewClient client;
QUrl url("file:///some/file.qml");
QString locale("qt_QT");
client.language(url, locale);
QCOMPARE(client.messages.count(), 1);
QmlDebug::QPacket packet(client.dataStreamVersion(), client.messages.takeFirst());
qint8 command;
QUrl resultUrl;
QString resultLocale;
packet >> command >> resultUrl >> resultLocale;
QCOMPARE(static_cast<QmlPreviewClient::Command>(command), QmlPreviewClient::Language);
QCOMPARE(resultUrl, url);
QCOMPARE(resultLocale, locale);
QVERIFY(packet.atEnd());
}
void QmlPreviewClientTest::testMessageReceived()
{
TestableQmlPreviewClient client;

View File

@@ -36,7 +36,6 @@ private slots:
void testLoadFile();
void testAnnounceFile();
void testZoom();
void testLanguate();
void testMessageReceived();
};

View File

@@ -78,21 +78,6 @@ void QmlPreviewPluginTest::testZoomFactorProperty()
QCOMPARE(spy.count(), 2);
}
void QmlPreviewPluginTest::testLocaleProperty()
{
ExtensionSystem::IPlugin *plugin = getPlugin();
QVERIFY(plugin);
QSignalSpy spy(plugin, SIGNAL(localeChanged(QString)));
QCOMPARE(plugin->property("locale").toString(), QString());
plugin->setProperty("locale", "de_DE");
QCOMPARE(plugin->property("locale").toString(), QString("de_DE"));
plugin->setProperty("locale", "qt_QT");
QCOMPARE(plugin->property("locale").toString(), QString("qt_QT"));
QCOMPARE(spy.count(), 2);
}
void QmlPreviewPluginTest::testFpsHandlerProperty()
{
ExtensionSystem::IPlugin *plugin = getPlugin();

View File

@@ -42,7 +42,6 @@ public:
private slots:
void testFileLoaderProperty();
void testZoomFactorProperty();
void testLocaleProperty();
void testFpsHandlerProperty();
};