Commit 0f9495b9 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Start to implement export autotest here

parent 5bcd74fa
......@@ -6,3 +6,4 @@ ecm_mark_as_test(utilstest)
target_link_libraries( utilstest Qt5::Test pimdataexporterprivate KF5::ConfigCore)
add_subdirectory(notes)
add_subdirectory(calendar)
add_definitions( -DPIMDATAEXPORTER_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data" )
set( exportcalendarsjobinterfacetest_SRCS exportcalendarsjobinterfacetest.cpp ../resourceconvertertest.cpp )
add_executable( exportcalendarsjobinterfacetest ${exportcalendarsjobinterfacetest_SRCS})
add_test(NAME exportcalendarsjobinterfacetest COMMAND exportcalendarsjobinterfacetest)
ecm_mark_as_test(exportcalendarsjobinterfacetest)
target_link_libraries(exportcalendarsjobinterfacetest Qt5::Test pimdataexporterprivate KF5::ConfigCore)
[Defaults]
Profile=Default
[PROFILE_Default]
EmailAddress=
FullName=laurent
Organization=
ReplyAddr=
ServerType=
[General]
Default Identity=1578759321
[Identity #0]
Default Domain=linux-zym0
Disable Fcc=false
Identity=laurent
Image Location=
Inline Signature=
Name=laurent
Signature Enabled=false
uoid=1578759321
[Network]
KnownHosts=199.168.1.13
NoteHostDialogSize=596,334
Port=12
SenderID=VV
[SelectNoteFolder]
DefaultFolder=31
[$Version]
update_info=noteglobalsettings.upd:initial-noteagent-migration,noteglobalsettings.upd:selectcollection-noteagent-migration
[AgentTypeDialog]
Size=979,637
[Display]
width=260
[DownloadDialog Settings]
Height 1080=522
Width 1920=700
[Editor]
titlefont=Liberation Sans,12,-1,5,50,0,0,0,0,0,Regular
[KFileDialog Settings]
Height 1080=540
Width 1920=960
[KNoteDeleteSelectedNotesDialog]
Size=300,200
[KNoteFindDialog]
Size=461,270
[KNotePrintSelectedNotesDialog]
Size=960,656
[KNoteSimpleConfigDialog]
Size=600,400
[KNotesKeyDialog]
Size=1120,685
[KPimPrintPreviewDialog]
Size=1054,732
[Migratekde4]
Version=1
[Misc]
SystemTrayShowNotes=true
[SelectedNotefolderDialog]
Size=600,400
/*
Copyright (C) 2020 Laurent Montel <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "exportcalendarsjobinterfacetest.h"
#include "archivestorage.h"
#include "../resourceconvertertest.h"
#include <QDebug>
#include <QTest>
#include <QSignalSpy>
QTEST_MAIN(ExportCalendarsJobInterfaceTest)
ExportCalendarsJobInterfaceTestImpl::ExportCalendarsJobInterfaceTestImpl(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep)
: ExportCalendarJobInterface(parent, typeSelected, archiveStorage, numberOfStep)
{
}
ExportCalendarsJobInterfaceTestImpl::~ExportCalendarsJobInterfaceTestImpl()
{
}
void ExportCalendarsJobInterfaceTestImpl::exportArchiveResource()
{
qDebug() << " not implement yet";
}
ExportCalendarsJobInterfaceTest::ExportCalendarsJobInterfaceTest(QObject *parent)
: QObject(parent)
{
}
void ExportCalendarsJobInterfaceTest::importNoteConfigTest1()
{
//Don't use setTestModeEnabled otherwise we can set env
//QStandardPaths::setTestModeEnabled(true);
qputenv("XDG_DATA_HOME", PIMDATAEXPORTER_DIR "/test1/share");
qputenv("XDG_CONFIG_HOME", PIMDATAEXPORTER_DIR "/test1/config");
//TODO fix file name.
const QString storeArchivePath(QStringLiteral("/tmp/foo.zip"));
ArchiveStorage *archiveStorage = new ArchiveStorage(storeArchivePath, this);
Q_ASSERT(archiveStorage->openArchive(true));
Utils::addVersion(archiveStorage->archive());
Utils::storeDataExportInfo(storeArchivePath, archiveStorage->archive());
ExportCalendarsJobInterfaceTestImpl *exportNote = new ExportCalendarsJobInterfaceTestImpl(this, {Utils::StoredType::Config}, archiveStorage, 1);
QSignalSpy finish(exportNote, &ExportCalendarsJobInterfaceTestImpl::jobFinished);
QSignalSpy error(exportNote, &ExportCalendarsJobInterfaceTestImpl::error);
exportNote->start();
QVERIFY(finish.wait());
QCOMPARE(error.count(), 0);
delete exportNote;
delete archiveStorage;
}
/*
Copyright (C) 2020 Laurent Montel <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef EXPORTCALENDARSJOBINTERFACETEST_H
#define EXPORTCALENDARSJOBINTERFACETEST_H
#include <QObject>
#include "calendar/exportcalendarjobinterface.h"
class ExportCalendarsJobInterfaceTestImpl : public ExportCalendarJobInterface
{
Q_OBJECT
public:
explicit ExportCalendarsJobInterfaceTestImpl(QObject *parent, Utils::StoredTypes typeSelected, ArchiveStorage *archiveStorage, int numberOfStep);
~ExportCalendarsJobInterfaceTestImpl();
protected:
void exportArchiveResource() override;
};
class ExportCalendarsJobInterfaceTest : public QObject
{
Q_OBJECT
public:
explicit ExportCalendarsJobInterfaceTest(QObject *parent = nullptr);
~ExportCalendarsJobInterfaceTest() = default;
private Q_SLOTS:
void importNoteConfigTest1();
};
#endif // EXPORTCALENDARSJOBINTERFACETEST_H
......@@ -39,8 +39,8 @@ ExportNotesJobInterfaceTestImpl::~ExportNotesJobInterfaceTestImpl()
void ExportNotesJobInterfaceTestImpl::convertCollectionIdsToRealPath(KConfigGroup &selectFolderNoteGroup, const QString &selectFolderNoteGroupStr)
{
ResourceConverterTest resourceImpl;
resourceImpl.convertCollectionIdsToRealPath(selectFolderNoteGroup, selectFolderNoteGroupStr);
ResourceConverterTest resourceConverterTest;
resourceConverterTest.convertCollectionIdsToRealPath(selectFolderNoteGroup, selectFolderNoteGroupStr);
}
void ExportNotesJobInterfaceTestImpl::exportArchiveResource()
......
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