summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2016-10-15 20:26:34 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-10-15 12:24:05 -0700
commit9c4b0170bfc321a31c6f3d0f7cd34edfa74fe1f4 (patch)
tree951fd3e66b4200dff28bbe80bef3ce458955d248
parentc1fbc70d83cb8a3755120c5d0203a20806b94c6d (diff)
downloadsubsurface-9c4b0170bfc321a31c6f3d0f7cd34edfa74fe1f4.tar.gz
Make all current written tests pass
Fixes a couple of issues with the tests. Also, a type in prefs.h is "short" while it's actually a boolean, this made me write the wrong testcase for this. Fixed this by setting the Qt wrapper to bool, but I didn't changed the c implementation because I tought I could break something. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--core/subsurface-qt/SettingsObjectWrapper.cpp4
-rw-r--r--core/subsurface-qt/SettingsObjectWrapper.h8
-rw-r--r--tests/testpreferences.cpp10
3 files changed, 11 insertions, 11 deletions
diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp
index 417b90411..009ca6403 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.cpp
+++ b/core/subsurface-qt/SettingsObjectWrapper.cpp
@@ -866,7 +866,7 @@ int ProxySettings::port() const
return prefs.proxy_port;
}
-short ProxySettings::auth() const
+bool ProxySettings::auth() const
{
return prefs.proxy_auth;
}
@@ -915,7 +915,7 @@ void ProxySettings::setPort(int value)
emit portChanged(value);
}
-void ProxySettings::setAuth(short value)
+void ProxySettings::setAuth(bool value)
{
if (value == prefs.proxy_auth)
return;
diff --git a/core/subsurface-qt/SettingsObjectWrapper.h b/core/subsurface-qt/SettingsObjectWrapper.h
index eeec3ab61..64e6a5a8a 100644
--- a/core/subsurface-qt/SettingsObjectWrapper.h
+++ b/core/subsurface-qt/SettingsObjectWrapper.h
@@ -288,7 +288,7 @@ class ProxySettings : public QObject {
Q_PROPERTY(int type READ type WRITE setType NOTIFY typeChanged)
Q_PROPERTY(QString host READ host WRITE setHost NOTIFY hostChanged)
Q_PROPERTY(int port READ port WRITE setPort NOTIFY portChanged)
- Q_PROPERTY(short auth READ auth WRITE setAuth NOTIFY authChanged)
+ Q_PROPERTY(bool auth READ auth WRITE setAuth NOTIFY authChanged)
Q_PROPERTY(QString user READ user WRITE setUser NOTIFY userChanged)
Q_PROPERTY(QString pass READ pass WRITE setPass NOTIFY passChanged)
@@ -297,7 +297,7 @@ public:
int type() const;
QString host() const;
int port() const;
- short auth() const;
+ bool auth() const;
QString user() const;
QString pass() const;
@@ -305,7 +305,7 @@ public slots:
void setType(int value);
void setHost(const QString& value);
void setPort(int value);
- void setAuth(short value);
+ void setAuth(bool value);
void setUser(const QString& value);
void setPass(const QString& value);
@@ -313,7 +313,7 @@ signals:
void typeChanged(int value);
void hostChanged(const QString& value);
void portChanged(int value);
- void authChanged(short value);
+ void authChanged(bool value);
void userChanged(const QString& value);
void passChanged(const QString& value);
private:
diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp
index 069e78db9..684795891 100644
--- a/tests/testpreferences.cpp
+++ b/tests/testpreferences.cpp
@@ -284,29 +284,29 @@ void TestPreferences::testPreferences()
auto proxy = pref->proxy;
proxy->setType(2);
proxy->setPort(80);
- proxy->setAuth((short) 5);
+ proxy->setAuth(true);
proxy->setHost("localhost");
proxy->setUser("unknown");
proxy->setPass("secret");
TEST(proxy->type(),2);
TEST(proxy->port(),80);
- TEST(proxy->auth(),(short) 5);
+ TEST(proxy->auth(),true);
TEST(proxy->host(),QStringLiteral("localhost"));
TEST(proxy->user(),QStringLiteral("unknown"));
TEST(proxy->pass(),QStringLiteral("secret"));
proxy->setType(3);
proxy->setPort(8080);
- proxy->setAuth((short) 6);
+ proxy->setAuth(false);
proxy->setHost("127.0.0.1");
proxy->setUser("unknown_1");
proxy->setPass("secret_1");
TEST(proxy->type(),3);
TEST(proxy->port(),8080);
- TEST(proxy->auth(),(short) 6);
- TEST(proxy->host(),QStringLiteral("localhost_1"));
+ TEST(proxy->auth(),false);
+ TEST(proxy->host(),QStringLiteral("127.0.0.1"));
TEST(proxy->user(),QStringLiteral("unknown_1"));
TEST(proxy->pass(),QStringLiteral("secret_1"));