summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-09-02 17:40:45 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2011-09-05 10:46:09 (GMT)
commitef774ee93cb561d072137f2a11c2d347bedf6342 (patch)
treef5b492964bc7b913430c7fabd8e57bb063c3bc7b /tests
parent4a6617b83612d79c8557102c9d313c28aee2aa0e (diff)
downloadQt-ef774ee93cb561d072137f2a11c2d347bedf6342.zip
Qt-ef774ee93cb561d072137f2a11c2d347bedf6342.tar.gz
Qt-ef774ee93cb561d072137f2a11c2d347bedf6342.tar.bz2
Restore Qt4.7 behaviour of QFileInfo::absolute(File)Path
Many applications relied on the undefined behaviour that the filesystem engines returned clean paths (despite the documentation stating that they may not), and consequently suffered regressions with Qt 4.8. Unix paths are once again cleaned if necessary. Windows/Symbian paths were already cleaned, but now use the utility function to check if a path is dirty, to avoid duplicated code. Task-number: QTBUG-19995 Change-Id: If8c18469f149291c9d079ae3da23bc2087bbd49a Reviewed-on: http://codereview.qt.nokia.com/4154 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Prasanth Ullattil <prasanth.ullattil@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qfileinfo/tst_qfileinfo.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp
index 4e4b92d..d7d57f6 100644
--- a/tests/auto/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp
@@ -482,6 +482,11 @@ void tst_QFileInfo::absolutePath_data()
QTest::newRow("c:\\autoexec.bat") << "c:\\autoexec.bat" << "C:/"
<< "autoexec.bat";
#endif
+ QTest::newRow("QTBUG-19995.1") << drivePrefix + "/System/Library/StartupItems/../Frameworks"
+ << drivePrefix + "/System/Library"
+ << "Frameworks";
+ QTest::newRow("QTBUG-19995.2") << drivePrefix + "/System/Library/StartupItems/../Frameworks/"
+ << drivePrefix + "/System/Library/Frameworks" << "";
}
void tst_QFileInfo::absolutePath()
@@ -503,6 +508,7 @@ void tst_QFileInfo::absFilePath_data()
QTest::newRow("relativeFile") << "tmp.txt" << QDir::currentPath() + "/tmp.txt";
QTest::newRow("relativeFileInSubDir") << "temp/tmp.txt" << QDir::currentPath() + "/" + "temp/tmp.txt";
+ QString drivePrefix;
#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
QString curr = QDir::currentPath();
@@ -511,7 +517,7 @@ void tst_QFileInfo::absFilePath_data()
QTest::newRow("absFilePath") << "c:\\home\\andy\\tmp.txt" << "C:/home/andy/tmp.txt";
// Make sure drive-relative paths return correct absolute paths (task 255326)
- QString drivePrefix = QDir::currentPath().left(2);
+ drivePrefix = QDir::currentPath().left(2);
QString nonCurrentDrivePrefix =
drivePrefix.left(1).compare("X", Qt::CaseInsensitive) == 0 ? QString("Y:") : QString("X:");
@@ -521,6 +527,8 @@ void tst_QFileInfo::absFilePath_data()
#else
QTest::newRow("absFilePath") << "/home/andy/tmp.txt" << "/home/andy/tmp.txt";
#endif
+ QTest::newRow("QTBUG-19995") << drivePrefix + "/System/Library/StartupItems/../Frameworks"
+ << drivePrefix + "/System/Library/Frameworks";
}
void tst_QFileInfo::absFilePath()