mirror of
https://github.com/QuasarApp/CQtDeployer.git
synced 2025-04-28 02:34:34 +00:00
fix tests for setTarget
This commit is contained in:
parent
bdc7e3a150
commit
0704ce8c80
@ -79,11 +79,14 @@ bool Deploy::initDir(const QString &path) {
|
||||
void Deploy::setTargetDir(const QString &target) {
|
||||
|
||||
if (QuasarAppUtils::Params::isEndable("targetDir")) {
|
||||
targetDir = QuasarAppUtils::Params::getStrArg("targetDir");
|
||||
} else if (target.size() && QFileInfo(target).isDir()) {
|
||||
targetDir = QFileInfo(QuasarAppUtils::Params::getStrArg("targetDir")).absoluteFilePath();
|
||||
} else if (target.size()) {
|
||||
targetDir = QFileInfo(target).absoluteFilePath();
|
||||
} else {
|
||||
targetDir = QFileInfo(targets.begin().key()).absolutePath() + "/Distro";
|
||||
if (targets.size())
|
||||
targetDir = QFileInfo(targets.begin().key()).absolutePath() + "/Distro";
|
||||
|
||||
targetDir = QFileInfo("./Distro").absoluteFilePath();
|
||||
qInfo () << "flag targetDir not used." << "use default target dir :" << targetDir;
|
||||
}
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ private slots:
|
||||
void testDeployLdLinux();
|
||||
|
||||
void testQmlExtrct();
|
||||
void testSetTargetDir();
|
||||
|
||||
void mainTests();
|
||||
void testMSVC();
|
||||
@ -612,6 +613,28 @@ void deploytest::testQmlExtrct() {
|
||||
}
|
||||
}
|
||||
|
||||
void deploytest::testSetTargetDir() {
|
||||
|
||||
Deploy dep;
|
||||
|
||||
dep.setTargetDir();
|
||||
|
||||
QVERIFY(dep.targetDir == QFileInfo("./Distro").absoluteFilePath());
|
||||
dep.setTargetDir("./ff");
|
||||
QVERIFY(dep.targetDir == QFileInfo("./ff").absoluteFilePath());
|
||||
|
||||
int argc = 3;
|
||||
const char * argv[] = {"", "-targetDir", "./Distro2"};
|
||||
|
||||
QuasarAppUtils::Params::parseParams(argc, argv);
|
||||
|
||||
dep.setTargetDir();
|
||||
QVERIFY(dep.targetDir == QFileInfo("./Distro2").absoluteFilePath());
|
||||
dep.setTargetDir("./ff");
|
||||
QVERIFY(dep.targetDir == QFileInfo("./Distro2").absoluteFilePath());
|
||||
|
||||
}
|
||||
|
||||
void deploytest::mainTests() {
|
||||
#ifdef WITH_ALL_TESTS
|
||||
QVERIFY(mainTestOnlyC());
|
||||
|
Loading…
x
Reference in New Issue
Block a user