File: autotestbase.h

package info (click to toggle)
kemoticons 5.62.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 7,912 kB
  • sloc: xml: 7,541; cpp: 2,002; sh: 27; makefile: 9
file content (47 lines) | stat: -rw-r--r-- 1,758 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
    Test base class

    Copyright (c) 2004      by Richard Smith          <kde@metafoo.co.uk>
    Copyright (c) 2005      by Duncan Mac-Vicar       <duncan@kde.org>
    Copyright (c) 2014      by Alex Merry             <alex.merry@kde.org>

    Kopete    (c) 2002-2005 by the Kopete developers  <kopete-devel@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.                                   *
    *                                                                       *
    *************************************************************************
*/

#ifndef AUTOTESTBASE_H
#define AUTOTESTBASE_H

#include <QDebug>
#include <QDir>

static bool copyTheme(const QString &dir, const QDir &baseThemeDir, const QString &themeName)
{
    QDir sourceThemeDir(dir);
    if (!sourceThemeDir.exists()) {
        return false;
    }
    QDir themeDir(baseThemeDir.absolutePath() + QLatin1Char('/') + themeName);
    themeDir.removeRecursively();
    themeDir.mkpath(QStringLiteral("."));

    const auto files = sourceThemeDir.entryList(QDir::Files);
    for (const QString &fileName : files) {
        if (!QFile::copy(sourceThemeDir.filePath(fileName),
                         themeDir.filePath(fileName))) {
            qWarning() << "couldn't copy" << dir << "/" << fileName;
            return false;
        }
    }
    return true;
}

#endif // AUTOTESTBASE_H