on xenial help sign in
add a test
63c582fLukáš Tinkl
qml/Launcher/Drawer.qml+1
@@ -84,6 +84,7 @@ FocusScope {
84
84
85 TextField {
85 TextField {
86 id: searchField
86 id: searchField
87+ objectName: "searchField"
87 anchors { left: parent.left; top: parent.top; right: parent.right; margins: units.gu(1) }
88 anchors { left: parent.left; top: parent.top; right: parent.right; margins: units.gu(1) }
88 placeholderText: i18n.tr("Search…")
89 placeholderText: i18n.tr("Search…")
89 focus: true
90 focus: true
tests/mocks/Unity/Launcher/MockAppDrawerModel.cpp−1
@@ -48,7 +48,6 @@ MockAppDrawerModel::MockAppDrawerModel(QObject *parent):
48 m_list.append(item);
48 m_list.append(item);
49 item = new MockLauncherItem("libreoffice", "/usr/share/applications/libreoffice.desktop","Libre Office", "libreoffice", this);
49 item = new MockLauncherItem("libreoffice", "/usr/share/applications/libreoffice.desktop","Libre Office", "libreoffice", this);
50 m_list.append(item);
50 m_list.append(item);
51− qDebug() << "mock model created";
52
51
53 qsrand(QDateTime::currentMSecsSinceEpoch() / 1000);
52 qsrand(QDateTime::currentMSecsSinceEpoch() / 1000);
54}
53}
tests/qmltests/Launcher/tst_Launcher.qml+33
@@ -1478,5 +1478,38 @@ Rectangle {
1478
1478
1479 launcher.available = true;
1479 launcher.available = true;
1480 }
1480 }
1481+
1482+ function dragDrawerIntoView() {
1483+ var startX = launcher.dragAreaWidth/2;
1484+ var startY = launcher.height/2;
1485+ touchFlick(launcher,
1486+ startX, startY,
1487+ startX+units.gu(35), startY);
1488+
1489+ var drawer = findChild(launcher, "drawer");
1490+ verify(!!drawer);
1491+
1492+ // wait until it gets fully extended
1493+ // a tryCompare doesn't work since
1494+ // compare(-0.000005917593600024418, 0);
1495+ // is true and in this case we want exactly 0 or will have pain later on
1496+ tryCompareFunction( function(){ return drawer.x === 0; }, true );
1497+ tryCompare(launcher, "state", "drawer");
1498+ tryCompare(launcher, "drawerShown", true);
1499+
1500+ return drawer;
1501+ }
1502+
1503+ function test_directSearch() {
1504+ var drawer = dragDrawerIntoView();
1505+ verify(!!drawer);
1506+
1507+ tryCompare(drawer, "focus", true);
1508+
1509+ var searchField = findChild(drawer, "searchField");
1510+ verify(searchField);
1511+ typeString("cam");
1512+ tryCompare(searchField, "displayText", "cam");
1513+ }
1481 }
1514 }
1482}
1515}