feat(GODT-3046): added addressChanged and addressChangedLogout to gui-tester.

This commit is contained in:
Xavier Michelon
2023-10-31 18:19:44 +01:00
parent eeb514cc81
commit b34f5d072f
4 changed files with 86 additions and 34 deletions

View File

@ -786,7 +786,7 @@ Status GRPCService::InstallTLSCertificate(ServerContext *, Empty const *, Empty
app().log().debug(__FUNCTION__); app().log().debug(__FUNCTION__);
SPStreamEvent event; SPStreamEvent event;
qtProxy_.installTLSCertificate(); qtProxy_.installTLSCertificate();
switch (app().mainWindow().settingsTab().nextTLSCertIntallResult()) { switch (app().mainWindow().settingsTab().nextTLSCertInstallResult()) {
case SettingsTab::TLSCertInstallResult::Success: case SettingsTab::TLSCertInstallResult::Success:
event = newCertificateInstallSuccessEvent(); event = newCertificateInstallSuccessEvent();
break; break;

View File

@ -31,6 +31,18 @@ QString const colorSchemeLight = "light"; ///< THe light color scheme name.
} }
//****************************************************************************************************************************************************
/// \brief Connect an address error button to the generation of an address error event.
///
/// \param[in] button The error button.
/// \param[in] edit The edit containing the address.
/// \param[in] eventGenerator The factory function creating the event.
//****************************************************************************************************************************************************
void connectAddressError(QPushButton *button, QLineEdit* edit, bridgepp::SPStreamEvent (*eventGenerator)(QString const &)) {
QObject::connect(button, &QPushButton::clicked, [edit, eventGenerator]() { app().grpc().sendEvent(eventGenerator(edit->text())); });
}
//**************************************************************************************************************************************************** //****************************************************************************************************************************************************
/// \param[in] parent The parent widget of the tab. /// \param[in] parent The parent widget of the tab.
//**************************************************************************************************************************************************** //****************************************************************************************************************************************************
@ -50,10 +62,9 @@ SettingsTab::SettingsTab(QWidget *parent)
app().grpc().sendEvent( app().grpc().sendEvent(
newDiskCacheErrorEvent(grpc::DiskCacheErrorType::DISK_FULL_ERROR)); newDiskCacheErrorEvent(grpc::DiskCacheErrorType::DISK_FULL_ERROR));
}); });
connect(ui_.buttonNoActiveKeyForRecipient, &QPushButton::clicked, [&]() { connectAddressError(ui_.buttonNoActiveKeyForRecipient, ui_.editAddressErrors, newNoActiveKeyForRecipientEvent);
app().grpc().sendEvent( connectAddressError(ui_.buttonAddressChanged, ui_.editAddressErrors, newAddressChangedEvent);
newNoActiveKeyForRecipientEvent(ui_.editNoActiveKeyForRecipient->text())); connectAddressError(ui_.buttonAddressChangedLogout, ui_.editAddressErrors, newAddressChangedLogoutEvent);
});
connect(ui_.checkNextCacheChangeWillSucceed, &QCheckBox::toggled, this, &SettingsTab::updateGUIState); connect(ui_.checkNextCacheChangeWillSucceed, &QCheckBox::toggled, this, &SettingsTab::updateGUIState);
connect(ui_.buttonUpdateError, &QPushButton::clicked, [&]() { connect(ui_.buttonUpdateError, &QPushButton::clicked, [&]() {
app().grpc().sendEvent(newUpdateErrorEvent(static_cast<grpc::UpdateErrorType>(ui_.comboUpdateError->currentIndex()))); app().grpc().sendEvent(newUpdateErrorEvent(static_cast<grpc::UpdateErrorType>(ui_.comboUpdateError->currentIndex())));
@ -154,7 +165,7 @@ bool SettingsTab::showSplashScreen() const {
//**************************************************************************************************************************************************** //****************************************************************************************************************************************************
/// \return true iff autosart is on. /// \return true iff autostart is on.
//**************************************************************************************************************************************************** //****************************************************************************************************************************************************
bool SettingsTab::isAutostartOn() const { bool SettingsTab::isAutostartOn() const {
return ui_.checkAutostart->isChecked(); return ui_.checkAutostart->isChecked();
@ -305,7 +316,7 @@ void SettingsTab::setBugReport(QString const &osType, QString const &osVersion,
//**************************************************************************************************************************************************** //****************************************************************************************************************************************************
void SettingsTab::installTLSCertificate() { void SettingsTab::installTLSCertificate() {
ui_.labelLastTLSCertInstall->setText(QString("Last install: %1").arg(QDateTime::currentDateTime().toString(Qt::ISODateWithMs))); ui_.labelLastTLSCertInstall->setText(QString("Last install: %1").arg(QDateTime::currentDateTime().toString(Qt::ISODateWithMs)));
ui_.checkTLSCertIsInstalled->setChecked(this->nextTLSCertIntallResult() == TLSCertInstallResult::Success); ui_.checkTLSCertIsInstalled->setChecked(this->nextTLSCertInstallResult() == TLSCertInstallResult::Success);
} }
@ -313,9 +324,7 @@ void SettingsTab::installTLSCertificate() {
/// \param[in] folderPath The folder path. /// \param[in] folderPath The folder path.
//**************************************************************************************************************************************************** //****************************************************************************************************************************************************
void SettingsTab::exportTLSCertificates(QString const &folderPath) { void SettingsTab::exportTLSCertificates(QString const &folderPath) {
ui_.labeLastTLSCertExport->setText(QString("%1 Export to %2") ui_.labeLastTLSCertExport->setText(QString("%1 Export to %2").arg(QDateTime::currentDateTime().toString(Qt::ISODateWithMs),folderPath));
.arg(QDateTime::currentDateTime().toString(Qt::ISODateWithMs))
.arg(folderPath));
} }
@ -338,7 +347,7 @@ bool SettingsTab::isTLSCertificateInstalled() const {
//**************************************************************************************************************************************************** //****************************************************************************************************************************************************
/// \return The value for the 'Next TLS cert install result'. /// \return The value for the 'Next TLS cert install result'.
//**************************************************************************************************************************************************** //****************************************************************************************************************************************************
SettingsTab::TLSCertInstallResult SettingsTab::nextTLSCertIntallResult() const { SettingsTab::TLSCertInstallResult SettingsTab::nextTLSCertInstallResult() const {
return TLSCertInstallResult(ui_.comboNextTLSCertInstallResult->currentIndex()); return TLSCertInstallResult(ui_.comboNextTLSCertInstallResult->currentIndex());
} }

View File

@ -33,13 +33,13 @@ public: // data types.
Success = 0, Success = 0,
Canceled = 1, Canceled = 1,
Failure = 2 Failure = 2
}; ///< Enumberation for the result of a TLS certificate installation. }; ///< Enumeration for the result of a TLS certificate installation.
public: // member functions. public: // member functions.
explicit SettingsTab(QWidget *parent = nullptr); ///< Default constructor. explicit SettingsTab(QWidget *parent = nullptr); ///< Default constructor.
SettingsTab(SettingsTab const &) = delete; ///< Disabled copy-constructor. SettingsTab(SettingsTab const &) = delete; ///< Disabled copy-constructor.
SettingsTab(SettingsTab &&) = delete; ///< Disabled assignment copy-constructor. SettingsTab(SettingsTab &&) = delete; ///< Disabled assignment copy-constructor.
~SettingsTab() = default; ///< Destructor. ~SettingsTab() override = default; ///< Destructor.
SettingsTab &operator=(SettingsTab const &) = delete; ///< Disabled assignment operator. SettingsTab &operator=(SettingsTab const &) = delete; ///< Disabled assignment operator.
SettingsTab &operator=(SettingsTab &&) = delete; ///< Disabled move assignment operator. SettingsTab &operator=(SettingsTab &&) = delete; ///< Disabled move assignment operator.
@ -62,7 +62,7 @@ public: // member functions.
QString landingPageLink() const; ///< Get the content of the 'Landing Page Link' edit. QString landingPageLink() const; ///< Get the content of the 'Landing Page Link' edit.
bool nextBugReportWillSucceed() const; ///< Get the status of the 'Next Bug Report Will Fail' check box. bool nextBugReportWillSucceed() const; ///< Get the status of the 'Next Bug Report Will Fail' check box.
bool isTLSCertificateInstalled() const; ///< Get the status of the 'TLS Certificate is installed' check box. bool isTLSCertificateInstalled() const; ///< Get the status of the 'TLS Certificate is installed' check box.
TLSCertInstallResult nextTLSCertIntallResult() const; ///< Get the value of the 'Next TLS Certificate install result' combo box. TLSCertInstallResult nextTLSCertInstallResult() const; ///< Get the value of the 'Next TLS Certificate install result' combo box.
bool nextTLSCertExportWillSucceed() const; ///< Get the status of the 'Next TLS Cert export will succeed' check box. bool nextTLSCertExportWillSucceed() const; ///< Get the status of the 'Next TLS Cert export will succeed' check box.
bool nextTLSKeyExportWillSucceed() const; ///< Get the status of the 'Next TLS Key export will succeed' check box. bool nextTLSKeyExportWillSucceed() const; ///< Get the status of the 'Next TLS Key export will succeed' check box.
QString hostname() const; ///< Get the value of the 'Hostname' edit. QString hostname() const; ///< Get the value of the 'Hostname' edit.
@ -99,7 +99,7 @@ private: // member functions.
void resetUI(); ///< Reset the widget. void resetUI(); ///< Reset the widget.
private: // data members. private: // data members.
Ui::SettingsTab ui_; ///< The GUI for the tab Ui::SettingsTab ui_ {}; ///< The GUI for the tab
}; };

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1131</width> <width>1212</width>
<height>762</height> <height>857</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -778,6 +778,9 @@
<property name="suffix"> <property name="suffix">
<string> ms</string> <string> ms</string>
</property> </property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum"> <property name="maximum">
<number>3600000</number> <number>3600000</number>
</property> </property>
@ -785,7 +788,7 @@
<number>100</number> <number>100</number>
</property> </property>
<property name="value"> <property name="value">
<number>1000</number> <number>0</number>
</property> </property>
</widget> </widget>
</item> </item>
@ -868,22 +871,62 @@
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_12"> <widget class="QGroupBox" name="groupBox">
<item> <property name="minimumSize">
<widget class="QPushButton" name="buttonNoActiveKeyForRecipient"> <size>
<property name="text"> <width>0</width>
<string>No Active Key For Recipient</string> <height>0</height>
</property> </size>
</widget> </property>
</item> <property name="title">
<item> <string>Address related errors</string>
<widget class="QLineEdit" name="editNoActiveKeyForRecipient"> </property>
<property name="text"> <layout class="QVBoxLayout" name="verticalLayout_9">
<string>dummy.user@proton.me</string> <item>
</property> <layout class="QHBoxLayout" name="horizontalLayout_12">
</widget> <item>
</item> <widget class="QLabel" name="label">
</layout> <property name="text">
<string>Address</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="editAddressErrors">
<property name="text">
<string>dummy.user@proton.me</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_15">
<item>
<widget class="QPushButton" name="buttonAddressChanged">
<property name="text">
<string>Address Changed</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonAddressChangedLogout">
<property name="text">
<string>Address Changed Logout</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonNoActiveKeyForRecipient">
<property name="text">
<string>No Active Key For Recipient</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="checkIsPortFree"> <widget class="QCheckBox" name="checkIsPortFree">