Fix use of file:// prefix with urls in tests, fails on Windows

parent 0efb76ba
......@@ -43,7 +43,6 @@ static const char TestDirectory[] = "bytearrayrawfilesynchronizertest";
static const char TestFileName[] = "test.data";
#if 0
static const char NotExistingUrl[] = "notexisting://";
static const char FileProtocolName[] = "file://";
#endif
static const int TestDataSize = 50;
static const char TestDataChar = 0;
......@@ -95,7 +94,7 @@ void ByteArrayRawFileSynchronizerFactoryTest::testCreate()
#if 0
void ByteArrayRawFileSynchronizerFactoryTest::testLoadFromUrl()
{
const QUrl fileUrl = mFileSystem->createFilePath( QStringLiteral(TestFileName) ).prepend( FileProtocolName );
const QUrl fileUrl = QUrl::fromLocalFile( mFileSystem->createFilePath( QStringLiteral(TestFileName) ) );
Kasten::ByteArrayRawFileSynchronizerFactory *factory = new Kasten::ByteArrayRawFileSynchronizerFactory();
AbstractDocument* document = factory->loadNewDocument( fileUrl );
......
......@@ -50,7 +50,6 @@ namespace Kasten
static const char TestDirectory[] = "bytearrayrawfilesynchronizertest";
static const char TestFileName[] = "test.data";
static const char NotExistingUrl[] = "notexisting://";
static const char FileProtocolName[] = "file://";
static const int TestDataSize = 50;
static const char TestDataChar = 0;
......@@ -93,7 +92,7 @@ void ByteArrayRawFileSynchronizerTest::init()
void ByteArrayRawFileSynchronizerTest::testLoadFromUrl()
{
const QUrl fileUrl = QUrl( mFileSystem->createFilePath( QLatin1String(TestFileName) ).prepend( QLatin1String(FileProtocolName) ) );
const QUrl fileUrl = QUrl::fromLocalFile( mFileSystem->createFilePath( QLatin1String(TestFileName) ) );
ByteArrayRawFileSynchronizer* synchronizer = new ByteArrayRawFileSynchronizer();
synchronizer->startLoad( fileUrl )->exec();
AbstractDocument* document = synchronizer->document();
......@@ -127,7 +126,7 @@ void ByteArrayRawFileSynchronizerTest::testLoadFromNotExistingUrl()
void ByteArrayRawFileSynchronizerTest::testNewSaveAsToUrl()
{
const QUrl fileUrl = QUrl( mFileSystem->createFilePath( QLatin1String(TestFileName) ).prepend( QLatin1String(FileProtocolName) ) );
const QUrl fileUrl = QUrl::fromLocalFile( mFileSystem->createFilePath( QLatin1String(TestFileName) ) );
ByteArrayDocument* document =
new Kasten::ByteArrayDocument(QStringLiteral("New created for test."));
......
......@@ -42,7 +42,6 @@ static const char TestFileName1[] = "test1.data";
#if 0
static const char TestFileName2[] = "test2.data";
static const char NotExistingFileName[] = "not.existing";
static const char FileProtocolName[] = "file://";
static const char NotExistingUrlName[] = "not://existing";
#endif
static const char TestData1[] = "TestData1";
......@@ -114,7 +113,7 @@ void TestDocumentFileSynchronizerFactoryTest::testCreate()
void TestDocumentFileSynchronizerFactoryTest::testLoadFromFile()
{
const QByteArray testData( TestData1 );
const QUrl fileUrl = mFileSystem->createFilePath( QStringLiteral(TestFileName1) ).prepend( FileProtocolName );
const QUrl fileUrl = QUrl::fromLocalFile( mFileSystem->createFilePath( QStringLiteral(TestFileName1) ) );
Kasten::TestDocumentFileSynchronizerFactory* factory = new Kasten::TestDocumentFileSynchronizerFactory();
AbstractDocument* document = factory->loadNewDocument( fileUrl );
......@@ -146,7 +145,7 @@ void TestDocumentFileSynchronizerFactoryTest::testLoadFromNotExistingUrl()
void TestDocumentFileSynchronizerFactoryTest::testLoadFromNotExistingFile()
{
const QUrl fileUrl = mFileSystem->createFilePath( QStringLiteral(NotExistingFileName) ).prepend( FileProtocolName );
const QUrl fileUrl = QUrl::fromLocalFile( mFileSystem->createFilePath( QStringLiteral(NotExistingFileName) ) );
Kasten::TestDocumentFileSynchronizerFactory* factory = new Kasten::TestDocumentFileSynchronizerFactory();
AbstractDocument* document = factory->loadNewDocument( fileUrl );
......@@ -157,7 +156,7 @@ void TestDocumentFileSynchronizerFactoryTest::testLoadFromNotExistingFile()
void TestDocumentFileSynchronizerFactoryTest::testLoadSaveFile()
{
const QByteArray otherData( TestData2 );
const QUrl fileUrl = mFileSystem->createFilePath( QStringLiteral(TestFileName1) ).prepend( FileProtocolName );
const QUrl fileUrl = QUrl::fromLocalFile( mFileSystem->createFilePath( QStringLiteral(TestFileName1) ) );
Kasten::TestDocumentFileSynchronizerFactory* factory = new Kasten::TestDocumentFileSynchronizerFactory();
AbstractDocument* document = factory->loadNewDocument( fileUrl );
......@@ -179,7 +178,7 @@ void TestDocumentFileSynchronizerFactoryTest::testLoadReloadFile()
{
const QByteArray otherData( TestData2 );
const QString filePath = mFileSystem->createFilePath( QStringLiteral(TestFileName1) );
const QUrl fileUrl = QString( filePath ).prepend( FileProtocolName );
const QUrl fileUrl = QUrl::fromLocalFile( filePath );
Kasten::TestDocumentFileSynchronizerFactory* factory = new Kasten::TestDocumentFileSynchronizerFactory();
AbstractDocument* document = factory->loadNewDocument( fileUrl );
......@@ -203,9 +202,9 @@ void TestDocumentFileSynchronizerFactoryTest::testLoadReloadFile()
void TestDocumentFileSynchronizerFactoryTest::testConnectToFile()
{
const QByteArray otherData( TestData2 );
const QUrl fileUrl1 = mFileSystem->createFilePath( QStringLiteral(TestFileName1) ).prepend( FileProtocolName );
const QUrl fileUrl1 = QUrl::::fromLocalFile( mFileSystem->createFilePath( QStringLiteral(TestFileName1) ) );
const QString filePath2 = mFileSystem->createFilePath( QStringLiteral(TestFileName2) );
const QUrl fileUrl2 = QString( filePath2 ).prepend( FileProtocolName );
const QUrl fileUrl2 = QUrl::fromLocalFile( filePath2 );
Kasten::TestDocumentFileSynchronizerFactory* factory = new Kasten::TestDocumentFileSynchronizerFactory();
Kasten::TestDocument* testDocument = new Kasten::TestDocument();
......
......@@ -46,7 +46,6 @@ static const char TestDirectory[] = "testdocumentfile1synchronizertest";
static const char TestFileName1[] = "test1.data";
static const char TestFileName2[] = "test2.data";
static const char NotExistingFileName[] = "not.existing";
static const char FileProtocolName[] = "file://";
static const char NotExistingUrlName[] = "not://existing";
static const char TestData1[] = "TestData1";
static const char TestData2[] = "TestData2";
......@@ -105,7 +104,7 @@ void TestDocumentFileSynchronizerTest::checkFileContent( const QUrl& fileUrl, co
void TestDocumentFileSynchronizerTest::testLoadFromFile()
{
const QByteArray testData( TestData1 );
const QUrl fileUrl = QUrl( mFileSystem->createFilePath( QLatin1String(TestFileName1) ).prepend( QLatin1String(FileProtocolName) ) );
const QUrl fileUrl = QUrl::fromLocalFile( mFileSystem->createFilePath( QLatin1String(TestFileName1) ) );
Kasten::TestDocumentFileSynchronizer* synchronizer = new Kasten::TestDocumentFileSynchronizer();
synchronizer->startLoad( fileUrl )->exec();
......@@ -139,7 +138,7 @@ void TestDocumentFileSynchronizerTest::testLoadFromNotExistingUrl()
void TestDocumentFileSynchronizerTest::testLoadFromNotExistingFile()
{
const QUrl fileUrl = QUrl( mFileSystem->createFilePath( QLatin1String(NotExistingFileName) ).prepend( QLatin1String(FileProtocolName) ) );
const QUrl fileUrl = QUrl::fromLocalFile( mFileSystem->createFilePath( QLatin1String(NotExistingFileName) ) );
Kasten::TestDocumentFileSynchronizer* synchronizer = new Kasten::TestDocumentFileSynchronizer();
synchronizer->startLoad( fileUrl )->exec();
Kasten::AbstractDocument* document = synchronizer->document();
......@@ -151,7 +150,7 @@ void TestDocumentFileSynchronizerTest::testLoadFromNotExistingFile()
void TestDocumentFileSynchronizerTest::testLoadSaveFile()
{
const QByteArray otherData( TestData2 );
const QUrl fileUrl = QUrl( mFileSystem->createFilePath( QLatin1String(TestFileName1) ).prepend( QLatin1String(FileProtocolName) ) );
const QUrl fileUrl = QUrl::fromLocalFile( mFileSystem->createFilePath( QLatin1String(TestFileName1) ) );
Kasten::TestDocumentFileSynchronizer* synchronizer = new Kasten::TestDocumentFileSynchronizer();
synchronizer->startLoad( fileUrl )->exec();
Kasten::AbstractDocument* document = synchronizer->document();
......@@ -172,7 +171,7 @@ void TestDocumentFileSynchronizerTest::testLoadReloadFile()
{
const QByteArray otherData( TestData2 );
const QString filePath = mFileSystem->createFilePath( QLatin1String(TestFileName1) );
const QUrl fileUrl = QUrl( QString( filePath ).prepend( QLatin1String(FileProtocolName) ) );
const QUrl fileUrl = QUrl::fromLocalFile( QString( filePath ) );
Kasten::TestDocumentFileSynchronizer* synchronizer = new Kasten::TestDocumentFileSynchronizer();
synchronizer->startLoad( fileUrl )->exec();
......@@ -197,9 +196,9 @@ void TestDocumentFileSynchronizerTest::testChangeFile()
{
const QByteArray data( TestData1 );
const QByteArray otherData( TestData2 );
const QUrl fileUrl1 = QUrl( mFileSystem->createFilePath( QLatin1String(TestFileName1) ).prepend( QLatin1String(FileProtocolName) ) );
const QUrl fileUrl1 = QUrl::fromLocalFile( mFileSystem->createFilePath( QLatin1String(TestFileName1) ) );
const QString filePath2 = mFileSystem->createFilePath( QLatin1String(TestFileName2) );
const QUrl fileUrl2 = QUrl( QString( filePath2 ).prepend( QLatin1String(FileProtocolName) ) );
const QUrl fileUrl2 = QUrl::fromLocalFile( filePath2 );
// load from 1
Kasten::TestDocumentFileSynchronizer* synchronizer = new Kasten::TestDocumentFileSynchronizer();
......@@ -219,9 +218,9 @@ void TestDocumentFileSynchronizerTest::testChangeFile()
void TestDocumentFileSynchronizerTest::testConnectToFile()
{
const QByteArray otherData( TestData2 );
const QUrl fileUrl1 = QUrl( mFileSystem->createFilePath( QLatin1String(TestFileName1) ).prepend( QLatin1String(FileProtocolName) ) );
const QUrl fileUrl1 = QUrl::fromLocalFile( mFileSystem->createFilePath( QLatin1String(TestFileName1) ) );
const QString filePath2 = mFileSystem->createFilePath( QLatin1String(TestFileName2) );
const QUrl fileUrl2 = QUrl( QString( filePath2 ).prepend( QLatin1String(FileProtocolName) ) );
const QUrl fileUrl2 = QUrl::fromLocalFile( QString( filePath2 ) );
Kasten::TestDocument* testDocument = new Kasten::TestDocument();
Kasten::AbstractDocument* document = testDocument;
......@@ -251,7 +250,7 @@ void TestDocumentFileSynchronizerTest::testHeader()
const QByteArray header( Header1);
const QByteArray otherData( TestData2 );
const QString filePath = mFileSystem->createFilePath( QLatin1String(TestFileName1) );
const QUrl fileUrl = QUrl( QString( filePath ).prepend( QLatin1String(FileProtocolName) ) );
const QUrl fileUrl = QUrl::fromLocalFile( filePath );
// TODO: failing calls in AbstractDocumentFileSystemSynchronizer trigger GUI here, so far it worked ;)
#if 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment