Can pull folder on Windows.

This commit is contained in:
NissimHadar 2019-01-23 14:32:47 -08:00
parent 0c6d3be037
commit 12b8442e71
4 changed files with 30 additions and 7 deletions

View file

@ -93,7 +93,7 @@ void Nitpick::setup() {
if (_testRunnerMobile) { if (_testRunnerMobile) {
delete _testRunnerMobile; delete _testRunnerMobile;
} }
_testRunnerMobile = new TestRunnerMobile(_ui.workingFolderRunOnMobileLabel, _ui.connectDeviceButton, _ui.pullFolderButton, _ui.detectedDeviceLabel); _testRunnerMobile = new TestRunnerMobile(_ui.workingFolderRunOnMobileLabel, _ui.connectDeviceButton, _ui.pullFolderButton, _ui.detectedDeviceLabel, _ui.folderLineEdit);
} }
void Nitpick::startTestsEvaluation(const bool isRunningFromCommandLine, void Nitpick::startTestsEvaluation(const bool isRunningFromCommandLine,

View file

@ -16,13 +16,22 @@
#include "Nitpick.h" #include "Nitpick.h"
extern Nitpick* nitpick; extern Nitpick* nitpick;
TestRunnerMobile::TestRunnerMobile(QLabel* workingFolderLabel, QPushButton *conectDeviceButton, QPushButton *pullFolderButton, QLabel* detectedDeviceLabel, QObject* parent) TestRunnerMobile::TestRunnerMobile(
: QObject(parent) QLabel* workingFolderLabel,
QPushButton *connectDeviceButton,
QPushButton *pullFolderButton,
QLabel* detectedDeviceLabel,
QLineEdit *folderLineEdit,
QObject* parent
) : QObject(parent)
{ {
_workingFolderLabel = workingFolderLabel; _workingFolderLabel = workingFolderLabel;
_connectDeviceButton = conectDeviceButton; _connectDeviceButton = connectDeviceButton;
_pullFolderButton = pullFolderButton; _pullFolderButton = pullFolderButton;
_detectedDeviceLabel = detectedDeviceLabel; _detectedDeviceLabel = detectedDeviceLabel;
_folderLineEdit = folderLineEdit;
folderLineEdit->setText("/sdcard/DCIM/TEST");
} }
TestRunnerMobile::~TestRunnerMobile() { TestRunnerMobile::~TestRunnerMobile() {
@ -82,12 +91,14 @@ void TestRunnerMobile::connectDevice() {
QMessageBox::critical(0, "Too many devices detected", "Tests will run only if a single device is attached"); QMessageBox::critical(0, "Too many devices detected", "Tests will run only if a single device is attached");
} else { } else {
_pullFolderButton->setEnabled(true);
_detectedDeviceLabel->setText(line2.remove(DEVICE)); _detectedDeviceLabel->setText(line2.remove(DEVICE));
_pullFolderButton->setEnabled(true);
_folderLineEdit->setEnabled(true);
} }
} }
} }
void TestRunnerMobile::pullFolder() { void TestRunnerMobile::pullFolder() {
QString command = _adbCommand + " devices > " + _workingFolder + "/devices.txt"; QString command = _adbCommand + " pull " + _folderLineEdit->text() + " " + _workingFolder + " >" + _workingFolder + "/pullOutput.txt";
int result = system(command.toStdString().c_str());
} }

View file

@ -12,6 +12,7 @@
#define hifi_testRunnerMobile_h #define hifi_testRunnerMobile_h
#include <QLabel> #include <QLabel>
#include <QLineEdit>
#include <QObject> #include <QObject>
#include <QPushButton> #include <QPushButton>
@ -20,7 +21,14 @@
class TestRunnerMobile : public QObject, public TestRunner { class TestRunnerMobile : public QObject, public TestRunner {
Q_OBJECT Q_OBJECT
public: public:
explicit TestRunnerMobile(QLabel* workingFolderLabel, QPushButton *connectDeviceButton, QPushButton *pullFolderButton, QLabel* detectedDeviceLabel, QObject* parent = 0); explicit TestRunnerMobile(
QLabel* workingFolderLabel,
QPushButton *connectDeviceButton,
QPushButton *pullFolderButton,
QLabel* detectedDeviceLabel,
QLineEdit *folderLineEdit,
QObject* parent = 0
);
~TestRunnerMobile(); ~TestRunnerMobile();
void setWorkingFolderAndEnableControls(); void setWorkingFolderAndEnableControls();
@ -32,6 +40,7 @@ private:
QPushButton* _connectDeviceButton; QPushButton* _connectDeviceButton;
QPushButton* _pullFolderButton; QPushButton* _pullFolderButton;
QLabel* _detectedDeviceLabel; QLabel* _detectedDeviceLabel;
QLineEdit* _folderLineEdit;
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
const QString _adbExe{ "adb.exe" }; const QString _adbExe{ "adb.exe" };

View file

@ -623,6 +623,9 @@
</property> </property>
</widget> </widget>
<widget class="QLineEdit" name="folderLineEdit"> <widget class="QLineEdit" name="folderLineEdit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>