mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-18 17:27:20 +01:00
applied patches by Vadim Zhukov persgray@gmail.com to unit tests
This commit is contained in:
parent
48e1096c24
commit
8fcb090760
@ -92,11 +92,13 @@ void GeneratedScriptTest::runCompiler(const std::string &test_file,
|
|||||||
void GeneratedScriptTest::assertDirsEqual(const std::string &left_dir,
|
void GeneratedScriptTest::assertDirsEqual(const std::string &left_dir,
|
||||||
const std::string &right_dir)
|
const std::string &right_dir)
|
||||||
{
|
{
|
||||||
|
QStringList leftList, rightList;
|
||||||
QDirIterator leftIt(QString (left_dir.c_str()), QDir::Files, QDirIterator::Subdirectories);
|
QDirIterator leftIt(QString (left_dir.c_str()), QDir::Files, QDirIterator::Subdirectories);
|
||||||
QDirIterator rightIt(QString (right_dir.c_str()), QDir::Files, QDirIterator::Subdirectories);
|
QDirIterator rightIt(QString (right_dir.c_str()), QDir::Files, QDirIterator::Subdirectories);
|
||||||
while (leftIt.hasNext() && rightIt.hasNext())
|
while (leftIt.hasNext() && rightIt.hasNext())
|
||||||
{
|
{
|
||||||
assertFilesEqual(leftIt.next().toStdString(), rightIt.next().toStdString());
|
leftList += leftIt.next();
|
||||||
|
rightList += rightIt.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (leftIt.hasNext())
|
if (leftIt.hasNext())
|
||||||
@ -107,6 +109,16 @@ void GeneratedScriptTest::assertDirsEqual(const std::string &left_dir,
|
|||||||
{
|
{
|
||||||
CPPUNIT_FAIL("Directory " + right_dir + " contains more files than " + left_dir);
|
CPPUNIT_FAIL("Directory " + right_dir + " contains more files than " + left_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
leftList.sort();
|
||||||
|
rightList.sort();
|
||||||
|
|
||||||
|
QList<QString>::const_iterator i, j;
|
||||||
|
for (i = leftList.constBegin(), j = rightList.constBegin();
|
||||||
|
i != leftList.constEnd();
|
||||||
|
++i, ++j) {
|
||||||
|
assertFilesEqual(QString(*i).toStdString(), QString(*j).toStdString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneratedScriptTest::assertFilesEqual(const std::string &left_filename,
|
void GeneratedScriptTest::assertFilesEqual(const std::string &left_filename,
|
||||||
|
|||||||
@ -156,7 +156,7 @@ QPoint findItemPos(ObjectTreeViewItem *item, ObjectTreeView *tree)
|
|||||||
|
|
||||||
void instDialogClusterTest::closeContextMenu()
|
void instDialogClusterTest::closeContextMenu()
|
||||||
{
|
{
|
||||||
QMenu *menu;
|
QMenu *menu = NULL;
|
||||||
foreach(QWidget *w, QApplication::allWidgets())
|
foreach(QWidget *w, QApplication::allWidgets())
|
||||||
{
|
{
|
||||||
if (w->objectName() == "objectTreeContextMenu")
|
if (w->objectName() == "objectTreeContextMenu")
|
||||||
@ -177,7 +177,7 @@ void instDialogClusterTest::openContextMenu(ObjectManipulator *om,
|
|||||||
QPoint item_pos = findItemPos(item, tree);
|
QPoint item_pos = findItemPos(item, tree);
|
||||||
om->contextMenuRequested(item_pos);
|
om->contextMenuRequested(item_pos);
|
||||||
|
|
||||||
QMenu *menu;
|
QMenu *menu = NULL;
|
||||||
foreach(QWidget *w, QApplication::allWidgets())
|
foreach(QWidget *w, QApplication::allWidgets())
|
||||||
{
|
{
|
||||||
if (w->objectName() == "objectTreeContextMenu")
|
if (w->objectName() == "objectTreeContextMenu")
|
||||||
|
|||||||
@ -79,7 +79,7 @@ QPoint findItemPos(ObjectTreeViewItem *item, ObjectTreeView *tree)
|
|||||||
|
|
||||||
void instDialogCompileTest::closeContextMenu()
|
void instDialogCompileTest::closeContextMenu()
|
||||||
{
|
{
|
||||||
QMenu *menu;
|
QMenu *menu = NULL;
|
||||||
foreach(QWidget *w, QApplication::allWidgets())
|
foreach(QWidget *w, QApplication::allWidgets())
|
||||||
{
|
{
|
||||||
if (w->objectName() == "objectTreeContextMenu")
|
if (w->objectName() == "objectTreeContextMenu")
|
||||||
|
|||||||
@ -97,7 +97,7 @@ QPoint findItemPos(ObjectTreeViewItem *item, ObjectTreeView *tree)
|
|||||||
|
|
||||||
void instDialogInspectTest::closeContextMenu()
|
void instDialogInspectTest::closeContextMenu()
|
||||||
{
|
{
|
||||||
QMenu *menu;
|
QMenu *menu = NULL;
|
||||||
foreach(QWidget *w, QApplication::allWidgets())
|
foreach(QWidget *w, QApplication::allWidgets())
|
||||||
{
|
{
|
||||||
if (w->objectName() == "objectTreeContextMenu")
|
if (w->objectName() == "objectTreeContextMenu")
|
||||||
|
|||||||
@ -137,7 +137,10 @@ void instDialogInstallTest::initTestCase()
|
|||||||
|
|
||||||
void instDialogInstallTest::cleanupTestCase()
|
void instDialogInstallTest::cleanupTestCase()
|
||||||
{
|
{
|
||||||
setenv("SSH_AUTH_SOCK", ssh_auth_sock, 1);
|
if (ssh_auth_sock != NULL)
|
||||||
|
setenv("SSH_AUTH_SOCK", ssh_auth_sock, 1);
|
||||||
|
else
|
||||||
|
unsetenv("SSH_AUTH_SOCK");
|
||||||
QDir().rmdir("test_install");
|
QDir().rmdir("test_install");
|
||||||
QFile::remove("test1.fw");
|
QFile::remove("test1.fw");
|
||||||
}
|
}
|
||||||
@ -356,7 +359,10 @@ void instDialogInstallTest::testInstall2()
|
|||||||
{
|
{
|
||||||
QVERIFY(list->topLevelItem(i)->text(1) == "Failure");
|
QVERIFY(list->topLevelItem(i)->text(1) == "Failure");
|
||||||
}
|
}
|
||||||
setenv("SSH_AUTH_SOCK", ssh_auth_sock, 1);
|
if (ssh_auth_sock != NULL)
|
||||||
|
setenv("SSH_AUTH_SOCK", ssh_auth_sock, 1);
|
||||||
|
else
|
||||||
|
unsetenv("SSH_AUTH_SOCK");
|
||||||
QString text = dlg->findChild<QTextBrowser*>("procLogDisplay")->toPlainText();
|
QString text = dlg->findChild<QTextBrowser*>("procLogDisplay")->toPlainText();
|
||||||
QVERIFY(!text.isEmpty());
|
QVERIFY(!text.isEmpty());
|
||||||
|
|
||||||
|
|||||||
@ -270,7 +270,7 @@ QPoint findItemPos(ObjectTreeViewItem *item, ObjectTreeView *tree)
|
|||||||
|
|
||||||
void instDialogObjectListTest::closeContextMenu()
|
void instDialogObjectListTest::closeContextMenu()
|
||||||
{
|
{
|
||||||
QMenu *menu;
|
QMenu *menu = NULL;
|
||||||
foreach(QWidget *w, QApplication::allWidgets())
|
foreach(QWidget *w, QApplication::allWidgets())
|
||||||
{
|
{
|
||||||
if (w->objectName() == "objectTreeContextMenu")
|
if (w->objectName() == "objectTreeContextMenu")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user