Merge lp:~osomon/webbrowser-app/empty-domains into lp:webbrowser-app

Proposed by Olivier Tilloy
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 262
Merged at revision: 260
Proposed branch: lp:~osomon/webbrowser-app/empty-domains
Merge into: lp:webbrowser-app
Diff against target: 115 lines (+8/-21)
5 files modified
src/Ubuntu/Components/Extras/Browser/history-domain-model.cpp (+1/-1)
src/Ubuntu/Components/Extras/Browser/history-domainlist-model.cpp (+3/-5)
src/Ubuntu/Components/Extras/Browser/history-timeframe-model.cpp (+2/-2)
tests/unittests/history-domainlist-model/tst_HistoryDomainListModelTests.cpp (+0/-13)
tests/unittests/history-timeframe-model/tst_HistoryTimeframeModelTests.cpp (+2/-0)
To merge this branch: bzr merge lp:~osomon/webbrowser-app/empty-domains
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Günter Schwann (community) Approve
Review via email: mp+178170@code.launchpad.net

Commit message

Ensure that the timeframe models are invalidated when the start date or the end date change.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Günter Schwann (schwann) wrote :

Code looks good, and fixes the bugs

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Ubuntu/Components/Extras/Browser/history-domain-model.cpp'
2--- src/Ubuntu/Components/Extras/Browser/history-domain-model.cpp 2013-07-30 09:56:17 +0000
3+++ src/Ubuntu/Components/Extras/Browser/history-domain-model.cpp 2013-08-01 21:53:23 +0000
4@@ -64,7 +64,7 @@
5 {
6 if (domain != m_domain) {
7 m_domain = domain;
8- invalidateFilter();
9+ invalidate();
10 Q_EMIT domainChanged();
11 }
12 }
13
14=== modified file 'src/Ubuntu/Components/Extras/Browser/history-domainlist-model.cpp'
15--- src/Ubuntu/Components/Extras/Browser/history-domainlist-model.cpp 2013-07-30 09:56:17 +0000
16+++ src/Ubuntu/Components/Extras/Browser/history-domainlist-model.cpp 2013-08-01 21:53:23 +0000
17@@ -71,11 +71,7 @@
18 if (!index.isValid()) {
19 return QVariant();
20 }
21- int row = index.row();
22- if ((row < 0) || (row >= m_domains.count())) {
23- return QVariant();
24- }
25- const QString domain = m_domains.keys().at(row);
26+ const QString domain = m_domains.keys().at(index.row());
27 HistoryDomainModel* entries = m_domains.value(domain);
28
29 switch (role) {
30@@ -134,6 +130,8 @@
31 connect(m_sourceModel, SIGNAL(rowsInserted(const QModelIndex&, int, int)),
32 SLOT(onRowsInserted(const QModelIndex&, int, int)));
33 connect(m_sourceModel, SIGNAL(modelReset()), SLOT(onModelReset()));
34+ connect(m_sourceModel, SIGNAL(layoutChanged(QList<QPersistentModelIndex>, QAbstractItemModel::LayoutChangeHint)),
35+ SLOT(onModelReset()));
36 }
37 endResetModel();
38 Q_EMIT sourceModelChanged();
39
40=== modified file 'src/Ubuntu/Components/Extras/Browser/history-timeframe-model.cpp'
41--- src/Ubuntu/Components/Extras/Browser/history-timeframe-model.cpp 2013-06-18 08:20:44 +0000
42+++ src/Ubuntu/Components/Extras/Browser/history-timeframe-model.cpp 2013-08-01 21:53:23 +0000
43@@ -58,7 +58,7 @@
44 {
45 if (start != m_start) {
46 m_start = start;
47- invalidateFilter();
48+ invalidate();
49 Q_EMIT startChanged();
50 }
51 }
52@@ -72,7 +72,7 @@
53 {
54 if (end != m_end) {
55 m_end = end;
56- invalidateFilter();
57+ invalidate();
58 Q_EMIT endChanged();
59 }
60 }
61
62=== modified file 'tests/unittests/history-domainlist-model/tst_HistoryDomainListModelTests.cpp'
63--- tests/unittests/history-domainlist-model/tst_HistoryDomainListModelTests.cpp 2013-07-23 22:07:18 +0000
64+++ tests/unittests/history-domainlist-model/tst_HistoryDomainListModelTests.cpp 2013-08-01 21:53:23 +0000
65@@ -118,21 +118,10 @@
66 history->add(QUrl("http://example.org/test"), "Example Domain", QUrl());
67 QCOMPARE(model->rowCount(), 2);
68
69- QSignalSpy spyRowsRemoved(model, SIGNAL(rowsRemoved(const QModelIndex&, int, int)));
70- qRegisterMetaType<QVector<int> >();
71- QSignalSpy spyDataChanged(model, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&, const QVector<int>&)));
72-
73 timeframe->setEnd(t1);
74- QVERIFY(spyRowsRemoved.isEmpty());
75- QVERIFY(!spyDataChanged.isEmpty());
76- verifyDataChanged(spyDataChanged, 1);
77 QCOMPARE(model->rowCount(), 2);
78
79 timeframe->setStart(t0);
80- QCOMPARE(spyRowsRemoved.count(), 1);
81- QList<QVariant> args = spyRowsRemoved.takeFirst();
82- QCOMPARE(args.at(1).toInt(), 1);
83- QCOMPARE(args.at(2).toInt(), 1);
84 QCOMPARE(model->rowCount(), 1);
85 }
86
87@@ -148,8 +137,6 @@
88
89 history->add(QUrl("http://example.org/"), "Example Domain", QUrl());
90 QVERIFY(spyRowsMoved.isEmpty());
91- QVERIFY(!spyDataChanged.isEmpty());
92- verifyDataChanged(spyDataChanged, 1);
93 }
94
95 void shouldUpdateDataWhenDataChanges()
96
97=== modified file 'tests/unittests/history-timeframe-model/tst_HistoryTimeframeModelTests.cpp'
98--- tests/unittests/history-timeframe-model/tst_HistoryTimeframeModelTests.cpp 2013-07-02 11:29:03 +0000
99+++ tests/unittests/history-timeframe-model/tst_HistoryTimeframeModelTests.cpp 2013-08-01 21:53:23 +0000
100@@ -73,6 +73,7 @@
101 QSignalSpy spy(timeframe, SIGNAL(startChanged()));
102 QDateTime start = QDateTime::currentDateTimeUtc();
103 timeframe->setStart(start);
104+ QCOMPARE(timeframe->start(), start);
105 QCOMPARE(spy.count(), 1);
106 timeframe->setStart(start);
107 QCOMPARE(spy.count(), 1);
108@@ -88,6 +89,7 @@
109 QSignalSpy spy(timeframe, SIGNAL(endChanged()));
110 QDateTime end = QDateTime::currentDateTimeUtc();
111 timeframe->setEnd(end);
112+ QCOMPARE(timeframe->end(), end);
113 QCOMPARE(spy.count(), 1);
114 timeframe->setEnd(end);
115 QCOMPARE(spy.count(), 1);

Subscribers

People subscribed via source and target branches

to status/vote changes: