Merge lp:~diegosarmentero/clickmanager-plugin/fix-compare-versions into lp:clickmanager-plugin

Proposed by Diego Sarmentero on 2013-09-30
Status: Merged
Approved by: Diego Sarmentero on 2013-09-30
Approved revision: 15
Merged at revision: 13
Proposed branch: lp:~diegosarmentero/clickmanager-plugin/fix-compare-versions
Merge into: lp:clickmanager-plugin
Diff against target: 30 lines (+3/-6)
2 files modified
src/application.cpp (+2/-5)
tests/testapplication.cpp (+1/-1)
To merge this branch: bzr merge lp:~diegosarmentero/clickmanager-plugin/fix-compare-versions
Reviewer Review Type Date Requested Status
Manuel de la Peña (community) Approve on 2013-09-30
PS Jenkins bot (community) continuous-integration Approve on 2013-09-30
Roberto Alsina (community) 2013-09-30 Approve on 2013-09-30
Review via email: mp+188327@code.launchpad.net

Commit message

- Fix versions comparison.

Description of the change

The code was expecting:
-1 for lower
0 for equal
1 for greater

And in fact it was returning the result of a substraction.

To post a comment you must log in.
Roberto Alsina (ralsina) :
review: Approve
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
15. By Diego Sarmentero on 2013-09-30

simplify comparison

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/application.cpp'
2--- src/application.cpp 2013-09-26 16:46:57 +0000
3+++ src/application.cpp 2013-09-30 14:52:16 +0000
4@@ -51,11 +51,8 @@
5
6 int result = debVS.CmpVersion(this->m_local_version.toUtf8().data(),
7 this->m_remote_version.toUtf8().data());
8- if(result == -1) {
9- this->m_update = true;
10- }else{
11- this->m_update = false;
12- }
13+
14+ this->m_update = result < 0;
15 }
16
17 void Application::setError(QString error) {
18
19=== modified file 'tests/testapplication.cpp'
20--- tests/testapplication.cpp 2013-09-25 20:47:03 +0000
21+++ tests/testapplication.cpp 2013-09-30 14:52:16 +0000
22@@ -26,7 +26,7 @@
23 void TestApplication::testCompareVersion()
24 {
25 Application app;
26- app.initializeApplication("package.name", "title", "1.3");
27+ app.initializeApplication("package.name", "title", "1.1");
28 QCOMPARE(app.updateRequired(), false);
29 QString version("1.4");
30 app.setRemoteVersion(version);

Subscribers

People subscribed via source and target branches