[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Failing testcase in kpasswdservertest [kde-runtime]
From: Dawit A <adawit () kde ! org>
Date: 2013-12-11 1:52:46
Message-ID: CALa28R7y8-aFc-8_j1vqeY15omkEwW0MDPf1sWySiy2ncbTbHA () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
On Tue, Dec 10, 2013 at 1:45 PM, Albert Astals Cid <aacid@kde.org> wrote:
> El Dimarts, 10 de desembre de 2013, a les 08:57:47, Dawit A va escriure:
> > Sorry for the late response. I did not see this email for some reason.
> None
> > of the test cases in testRetryDialog hit that assert on my machine.
>
> Is your Qt compiled in debug or release? Because as my original e-mail
> says if
> it's in release the assert won't trigger.
>
Ahh... I assumed you were talking about kde-runtime not Qt.
>
> > If this
> > unit test fails on your system, can you please enable the debug area for
> > KPasswdServer, run the unit test only for testRetryDialog only and
> provide
> > the output from it?
>
> Attached, is that enough?
>
That is fine. The test is indeed doing the wrong thing. It conflated two
cases that should be tested separately into one.
>
> > I am curious to know why it would start failing all of
> > the sudden since nothing was changed in that code base in a very long
> time.
>
> Because we switched to a debug Qt that now has asserts enabled.
>
Right.
Can you please check if the attached pass works fine for you? It fixes the
broken test case for me here.
[Attachment #5 (text/html)]
<div dir="ltr">On Tue, Dec 10, 2013 at 1:45 PM, Albert Astals Cid <span \
dir="ltr"><<a href="mailto:aacid@kde.org" \
target="_blank">aacid@kde.org</a>></span> wrote:<br><div class="gmail_extra"><div \
class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">El Dimarts, 10 de desembre de 2013, a les 08:57:47, Dawit A \
va escriure:<br> <div class="im">> Sorry for the late response. I did not see this \
email for some reason. None<br> > of the test cases in testRetryDialog hit that \
assert on my machine.<br> <br>
</div>Is your Qt compiled in debug or release? Because as my original e-mail says \
if<br> it's in release the assert won't \
trigger.<br></blockquote><div><br></div><div style>Ahh... I assumed you were talking \
about kde-runtime not Qt.</div><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
> If this<br>
> unit test fails on your system, can you please enable the debug area for<br>
> KPasswdServer, run the unit test only for testRetryDialog only and provide<br>
> the output from it?<br>
<br>
</div>Attached, is that enough?<br></blockquote><div><br></div><div style>That is \
fine. The test is indeed doing the wrong thing. It conflated two cases that should be \
tested separately into one. </div><blockquote class="gmail_quote" style="margin:0 0 \
0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
> I am curious to know why it would start failing all of<br>
> the sudden since nothing was changed in that code base in a very long time.<br>
<br>
</div>Because we switched to a debug Qt that now has asserts \
enabled.<br></blockquote><div><br></div><div style>Right.</div><div \
style><br></div><div style>Can you please check if the attached pass works fine for \
you? It fixes the broken test case for me here.</div>
</div></div></div>
--089e015376b6b7c92b04ed387e35--
["kpasswdservertest.patch" (application/octet-stream)]
diff --git kpasswdserver/tests/kpasswdservertest.cpp \
kpasswdserver/tests/kpasswdservertest.cpp index 3d7ad43..3b1da80 100644
--- kpasswdserver/tests/kpasswdservertest.cpp
+++ kpasswdserver/tests/kpasswdservertest.cpp
@@ -163,7 +163,7 @@ private Q_SLOTS:
queryAuthWithDialog(server, info, filledInfo, result);
}
- void testRetryDialog()
+ void testRejectRetryDialog()
{
KPasswdServer server(this);
server.setWalletDisabled(true);
@@ -185,6 +185,24 @@ private Q_SLOTS:
info.password.clear();
result = KIO::AuthInfo();
queryAuthWithDialog(server, info, filledInfo, result, QDialog::Rejected, \
QLatin1String("Invalid username or password")); + }
+
+ void testAcceptRetryDialog()
+ {
+ KPasswdServer server(this);
+ server.setWalletDisabled(true);
+
+ // What the app would ask
+ KIO::AuthInfo info;
+ info.url = KUrl("http://www.example.com");
+
+ // What the user would type
+ KIO::AuthInfo filledInfo(info);
+ filledInfo.username = "username";
+ filledInfo.password = "password";
+
+ KIO::AuthInfo result;
+ queryAuthWithDialog(server, info, filledInfo, result);
// Pretend that the returned credentials failed and initiate a retry,
// but this time continue the retry.
@@ -380,8 +398,10 @@ private:
const bool isCancelRetryDialogTest = (hasErrorMessage && code == \
QDialog::Rejected);
if (hasErrorMessage) {
+ // Retry dialog only knows Yes/No
+ const int retryCode = (code == QDialog::Accepted ? KDialog::Yes : \
KDialog::No); QMetaObject::invokeMethod(this, "checkRetryDialog",
- Qt::QueuedConnection, Q_ARG(int, code));
+ Qt::QueuedConnection, Q_ARG(int, retryCode));
}
if (!isCancelRetryDialogTest) {
@@ -398,9 +418,12 @@ private:
QCOMPARE(spy[0][0].toLongLong(), id);
//QCOMPARE(spy[0][1].toLongLong(), 3LL); // seqNr
result = spy[0][2].value<KIO::AuthInfo>();
- QCOMPARE(result.username, (isCancelRetryDialogTest ? QString() : \
filledInfo.username));
- QCOMPARE(result.password, (isCancelRetryDialogTest ? QString() : \
filledInfo.password));
- QCOMPARE(result.isModified(), (code == QDialog::Accepted ? true : false));
+ const QString username = (isCancelRetryDialogTest ? QString() : \
filledInfo.username); + const QString password = (isCancelRetryDialogTest ? \
QString() : filledInfo.password); + const bool modified = (code == \
QDialog::Accepted ? true : false); + QCOMPARE(result.username, username);
+ QCOMPARE(result.password, password);
+ QCOMPARE(result.isModified(), modified);
}
void concurrentQueryAuthWithDialog(KPasswdServer& server, const \
QList<KIO::AuthInfo>& infos,
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic