on xenial help sign in
When libusermetrics gives us an empty string, still show the infographic circle rather than hiding it. This is a follow-on to a branch [1] that changes the "no data available" label to the empty string.

[1] https://code.launchpad.net/~mpt/libusermetrics/1286276-no-data-sources/+merge/268042

commit4c3f2d7e225a561a8cf46916a71c1e9d5c065971 authorMichael Terry <michael.terry@canonical.com> dateTue 22 Sep 2015, 12:56 (11 years ago) parent76b625071e1456
3 files changed+6−9
qml/Greeter/Infographics.qml+1−1 tests/mocks/libusermetrics/UserMetrics.cpp+1−5 tests/qmltests/Greeter/tst_Infographics.qml+4−3
qml/Greeter/Infographics.qml+1−1
@@ -73,7 +73,7 @@ Item {
7373 notification.hideAnim.start()
7474 }
7575
76− visible: model.label !== ""
76+ visible: model.username !== ""
7777
7878 Component.onCompleted: startShowAnimation()
7979
tests/mocks/libusermetrics/UserMetrics.cpp+1−5
@@ -416,11 +416,7 @@ UserMetrics::~UserMetrics()
416416
417417QString UserMetrics::label() const
418418{
419− if (d_ptr->m_label.isEmpty()) {
420− return "No data";
421− } else {
422− return d_ptr->m_label;
423− }
419+ return d_ptr->m_label;
424420}
425421
426422QString UserMetrics::username() const
tests/qmltests/Greeter/tst_Infographics.qml+4−3
@@ -74,15 +74,16 @@ Item {
7474
7575 function test_set_username_data() {
7676 return [
77− { username: "has-password", label: "<b>19</b> minutes talk time" },
78− { username: "two-factor", label: "No data" },
79− { username: "", label: "No data" },
77+ { username: "has-password", label: "<b>19</b> minutes talk time", visible: true },
78+ { username: "two-factor", label: "", visible: true },
79+ { username: "", label: "", visible: false },
8080 ]
8181 }
8282
8383 function test_set_username(data) {
8484 infographicModel.username = data.username
8585 tryCompare(label, "text", data.label)
86+ compare(infographic.visible, data.visible);
8687 }
8788 }
8889