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.
4c3f2d7Michael Terry
qml/Greeter/Infographics.qml+1−1
@@ -73,7 +73,7 @@ Item {
73 notification.hideAnim.start()
73 notification.hideAnim.start()
74 }
74 }
75
75
76− visible: model.label !== ""
76+ visible: model.username !== ""
77
77
78 Component.onCompleted: startShowAnimation()
78 Component.onCompleted: startShowAnimation()
79
79
tests/mocks/libusermetrics/UserMetrics.cpp+1−5
@@ -416,11 +416,7 @@ UserMetrics::~UserMetrics()
416
416
417QString UserMetrics::label() const
417QString UserMetrics::label() const
418{
418{
419− if (d_ptr->m_label.isEmpty()) {
420− return "No data";
421− } else {
422− return d_ptr->m_label;
419+ return d_ptr->m_label;
423− }
424}
420}
425
421
426QString UserMetrics::username() const
422QString UserMetrics::username() const
tests/qmltests/Greeter/tst_Infographics.qml+4−3
@@ -74,15 +74,16 @@ Item {
74
74
75 function test_set_username_data() {
75 function test_set_username_data() {
76 return [
76 return [
77− { username: "has-password", label: "<b>19</b> minutes talk time" },
77+ { username: "has-password", label: "<b>19</b> minutes talk time", visible: true },
78− { username: "two-factor", label: "No data" },
78+ { username: "two-factor", label: "", visible: true },
79− { username: "", label: "No data" },
79+ { username: "", label: "", visible: false },
80 ]
80 ]
81 }
81 }
82
82
83 function test_set_username(data) {
83 function test_set_username(data) {
84 infographicModel.username = data.username
84 infographicModel.username = data.username
85 tryCompare(label, "text", data.label)
85 tryCompare(label, "text", data.label)
86+ compare(infographic.visible, data.visible);
86 }
87 }
87 }
88 }
88
89