mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 15:37:23 +00:00
add tests for abstract formatter
This commit is contained in:
parent
69c09d9ff8
commit
4337379177
@ -145,20 +145,21 @@ void AWFormatterHelper::editItems()
|
||||
}
|
||||
|
||||
|
||||
AWFormatterHelper::FormatterClass
|
||||
AWAbstractFormatter::FormatterClass
|
||||
AWFormatterHelper::defineFormatterClass(const QString stringType) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Define formatter class for" << stringType;
|
||||
|
||||
FormatterClass formatter = FormatterClass::NoFormat;
|
||||
AWAbstractFormatter::FormatterClass formatter
|
||||
= AWAbstractFormatter::FormatterClass::NoFormat;
|
||||
if (stringType == QString("DateTime"))
|
||||
formatter = FormatterClass::DateTime;
|
||||
formatter = AWAbstractFormatter::FormatterClass::DateTime;
|
||||
else if (stringType == QString("Float"))
|
||||
formatter = FormatterClass::Float;
|
||||
formatter = AWAbstractFormatter::FormatterClass::Float;
|
||||
else if (stringType == QString("NoFormat"))
|
||||
;
|
||||
else if (stringType == QString("Script"))
|
||||
formatter = FormatterClass::Script;
|
||||
formatter = AWAbstractFormatter::FormatterClass::Script;
|
||||
else
|
||||
qCWarning(LOG_AW) << "Unknown formatter" << stringType;
|
||||
|
||||
@ -187,19 +188,19 @@ void AWFormatterHelper::initFormatters()
|
||||
|
||||
|
||||
switch (metadata.second) {
|
||||
case FormatterClass::DateTime:
|
||||
case AWAbstractFormatter::FormatterClass::DateTime:
|
||||
m_formattersClasses[name]
|
||||
= new AWDateTimeFormatter(this, filePath);
|
||||
break;
|
||||
case FormatterClass::Float:
|
||||
case AWAbstractFormatter::FormatterClass::Float:
|
||||
m_formattersClasses[name]
|
||||
= new AWFloatFormatter(this, filePath);
|
||||
break;
|
||||
case FormatterClass::Script:
|
||||
case AWAbstractFormatter::FormatterClass::Script:
|
||||
m_formattersClasses[name]
|
||||
= new AWScriptFormatter(this, filePath);
|
||||
break;
|
||||
case FormatterClass::NoFormat:
|
||||
case AWAbstractFormatter::FormatterClass::NoFormat:
|
||||
m_formattersClasses[name] = new AWNoFormatter(this, filePath);
|
||||
break;
|
||||
}
|
||||
@ -258,7 +259,7 @@ void AWFormatterHelper::installDirectories()
|
||||
}
|
||||
|
||||
|
||||
QPair<QString, AWFormatterHelper::FormatterClass>
|
||||
QPair<QString, AWAbstractFormatter::FormatterClass>
|
||||
AWFormatterHelper::readMetadata(const QString filePath) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Read initial parameters from" << filePath;
|
||||
@ -268,10 +269,10 @@ AWFormatterHelper::readMetadata(const QString filePath) const
|
||||
QString name = settings.value(QString("Name"), filePath).toString();
|
||||
QString type
|
||||
= settings.value(QString("X-AW-Type"), QString("NoFormat")).toString();
|
||||
FormatterClass formatter = defineFormatterClass(type);
|
||||
AWAbstractFormatter::FormatterClass formatter = defineFormatterClass(type);
|
||||
settings.endGroup();
|
||||
|
||||
return QPair<QString, AWFormatterHelper::FormatterClass>(name, formatter);
|
||||
return QPair<QString, AWAbstractFormatter::FormatterClass>(name, formatter);
|
||||
}
|
||||
|
||||
|
||||
@ -289,15 +290,16 @@ void AWFormatterHelper::doCreateItem()
|
||||
}
|
||||
|
||||
qCInfo(LOG_AW) << "Selected type" << select;
|
||||
FormatterClass formatter = defineFormatterClass(select);
|
||||
AWAbstractFormatter::FormatterClass formatter
|
||||
= defineFormatterClass(select);
|
||||
switch (formatter) {
|
||||
case FormatterClass::DateTime:
|
||||
case AWAbstractFormatter::FormatterClass::DateTime:
|
||||
return createItem<AWDateTimeFormatter>();
|
||||
case FormatterClass::Float:
|
||||
case AWAbstractFormatter::FormatterClass::Float:
|
||||
return createItem<AWFloatFormatter>();
|
||||
case FormatterClass::Script:
|
||||
case AWAbstractFormatter::FormatterClass::Script:
|
||||
return createItem<AWScriptFormatter>();
|
||||
case FormatterClass::NoFormat:
|
||||
case AWAbstractFormatter::FormatterClass::NoFormat:
|
||||
return createItem<AWNoFormatter>();
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
#include "abstractextitemaggregator.h"
|
||||
|
||||
#include "awabstractformatter.h"
|
||||
|
||||
|
||||
class AWAbstractFormatter;
|
||||
|
||||
@ -29,8 +31,6 @@ class AWFormatterHelper : public AbstractExtItemAggregator
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum class FormatterClass { DateTime, Float, Script, NoFormat };
|
||||
|
||||
explicit AWFormatterHelper(QWidget *parent = nullptr);
|
||||
virtual ~AWFormatterHelper();
|
||||
QString convert(const QVariant &value, const QString &name) const;
|
||||
@ -46,12 +46,12 @@ public slots:
|
||||
|
||||
private:
|
||||
// methods
|
||||
AWFormatterHelper::FormatterClass
|
||||
AWAbstractFormatter::FormatterClass
|
||||
defineFormatterClass(const QString stringType) const;
|
||||
void initFormatters();
|
||||
void initKeys();
|
||||
void installDirectories();
|
||||
QPair<QString, AWFormatterHelper::FormatterClass>
|
||||
QPair<QString, AWAbstractFormatter::FormatterClass>
|
||||
readMetadata(const QString filePath) const;
|
||||
// parent methods
|
||||
void doCreateItem();
|
||||
|
@ -46,20 +46,58 @@ void AWAbstractFormatter::copyDefaults(AbstractExtItem *_other) const
|
||||
|
||||
QString AWAbstractFormatter::uniq() const
|
||||
{
|
||||
return QString("%1(%2)").arg(name()).arg(m_type);
|
||||
return QString("%1(%2)").arg(name()).arg(strType());
|
||||
}
|
||||
|
||||
|
||||
QString AWAbstractFormatter::type() const
|
||||
QString AWAbstractFormatter::strType() const
|
||||
{
|
||||
QString value;
|
||||
switch (m_type) {
|
||||
case FormatterClass::DateTime:
|
||||
value = QString("DateTime");
|
||||
break;
|
||||
case FormatterClass::Float:
|
||||
value = QString("Float");
|
||||
break;
|
||||
case FormatterClass::Script:
|
||||
value = QString("Script");
|
||||
break;
|
||||
case FormatterClass::NoFormat:
|
||||
value = QString("NoFormat");
|
||||
break;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
AWAbstractFormatter::FormatterClass AWAbstractFormatter::type() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
|
||||
void AWAbstractFormatter::setType(const QString _type)
|
||||
void AWAbstractFormatter::setStrType(const QString _type)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Type" << _type;
|
||||
|
||||
if (_type == QString("DateTime"))
|
||||
m_type = FormatterClass::DateTime;
|
||||
else if (_type == QString("Float"))
|
||||
m_type = FormatterClass::Float;
|
||||
else if (_type == QString("Script"))
|
||||
m_type = FormatterClass::Script;
|
||||
else
|
||||
m_type = FormatterClass::NoFormat;
|
||||
}
|
||||
|
||||
|
||||
void AWAbstractFormatter::setType(
|
||||
const AWAbstractFormatter::FormatterClass _type)
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Type" << static_cast<int>(_type);
|
||||
|
||||
m_type = _type;
|
||||
}
|
||||
|
||||
@ -71,7 +109,7 @@ void AWAbstractFormatter::readConfiguration()
|
||||
QSettings settings(fileName(), QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
setType(settings.value(QString("X-AW-Type"), m_type).toString());
|
||||
setStrType(settings.value(QString("X-AW-Type"), strType()).toString());
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
@ -84,7 +122,7 @@ void AWAbstractFormatter::writeConfiguration() const
|
||||
qCInfo(LOG_LIB) << "Configuration file" << settings.fileName();
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
settings.setValue(QString("X-AW-Type"), m_type);
|
||||
settings.setValue(QString("X-AW-Type"), strType());
|
||||
settings.endGroup();
|
||||
|
||||
settings.sync();
|
||||
|
@ -24,9 +24,12 @@
|
||||
class AWAbstractFormatter : public AbstractExtItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString type READ type WRITE setType)
|
||||
Q_PROPERTY(FormatterClass type READ type WRITE setType)
|
||||
Q_PROPERTY(QString strType READ strType WRITE setStrType)
|
||||
|
||||
public:
|
||||
enum class FormatterClass { DateTime, Float, Script, NoFormat };
|
||||
|
||||
explicit AWAbstractFormatter(QWidget *parent,
|
||||
const QString filePath = QString());
|
||||
virtual ~AWAbstractFormatter();
|
||||
@ -34,8 +37,10 @@ public:
|
||||
void copyDefaults(AbstractExtItem *_other) const;
|
||||
QString uniq() const;
|
||||
// properties
|
||||
QString type() const;
|
||||
void setType(const QString _type = QString("NoFormat"));
|
||||
QString strType() const;
|
||||
FormatterClass type() const;
|
||||
void setStrType(const QString type);
|
||||
void setType(const FormatterClass _type = FormatterClass::NoFormat);
|
||||
|
||||
public slots:
|
||||
virtual void readConfiguration();
|
||||
@ -44,7 +49,7 @@ public slots:
|
||||
|
||||
private:
|
||||
// properties
|
||||
QString m_type = QString("NoFormat");
|
||||
FormatterClass m_type = FormatterClass::NoFormat;
|
||||
};
|
||||
|
||||
|
||||
|
@ -115,7 +115,7 @@ int AWDateTimeFormatter::showConfiguration(const QVariant args)
|
||||
return ret;
|
||||
setName(ui->lineEdit_name->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setType(ui->label_typeValue->text());
|
||||
setStrType(ui->label_typeValue->text());
|
||||
setFormat(ui->lineEdit_format->text());
|
||||
|
||||
writeConfiguration();
|
||||
|
@ -212,7 +212,7 @@ int AWFloatFormatter::showConfiguration(const QVariant args)
|
||||
return ret;
|
||||
setName(ui->lineEdit_name->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setType(ui->label_typeValue->text());
|
||||
setStrType(ui->label_typeValue->text());
|
||||
setFormat(ui->comboBox_format->currentText().at(0).toLatin1());
|
||||
setPrecision(ui->spinBox_precision->value());
|
||||
setCount(ui->spinBox_width->value());
|
||||
|
@ -79,7 +79,7 @@ int AWNoFormatter::showConfiguration(const QVariant args)
|
||||
return ret;
|
||||
setName(ui->lineEdit_name->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setType(ui->label_typeValue->text());
|
||||
setStrType(ui->label_typeValue->text());
|
||||
|
||||
writeConfiguration();
|
||||
return ret;
|
||||
|
@ -174,7 +174,7 @@ int AWScriptFormatter::showConfiguration(const QVariant args)
|
||||
return ret;
|
||||
setName(ui->lineEdit_name->text());
|
||||
setComment(ui->lineEdit_comment->text());
|
||||
setType(ui->label_typeValue->text());
|
||||
setStrType(ui->label_typeValue->text());
|
||||
setAppendCode(ui->checkBox_appendCode->checkState() == Qt::Checked);
|
||||
setHasReturn(ui->checkBox_hasReturn->checkState() == Qt::Checked);
|
||||
setCode(ui->textEdit_code->toPlainText());
|
||||
|
@ -168,13 +168,13 @@ void ExtScript::setStrRedirect(const QString _redirect)
|
||||
qCDebug(LOG_LIB) << "Redirect" << _redirect;
|
||||
|
||||
if (_redirect == QString("stdout2sdterr"))
|
||||
m_redirect = Redirect::stdout2stderr;
|
||||
setRedirect(Redirect::stdout2stderr);
|
||||
else if (_redirect == QString("stderr2sdtout"))
|
||||
m_redirect = Redirect::stderr2stdout;
|
||||
setRedirect(Redirect::stderr2stdout);
|
||||
else if (_redirect == QString("swap"))
|
||||
m_redirect = Redirect::swap;
|
||||
setRedirect(Redirect::swap);
|
||||
else
|
||||
m_redirect = Redirect::nothing;
|
||||
setRedirect(Redirect::nothing);
|
||||
}
|
||||
|
||||
|
||||
@ -317,7 +317,7 @@ int ExtScript::showConfiguration(const QVariant args)
|
||||
setExecutable(ui->lineEdit_command->text());
|
||||
setPrefix(ui->lineEdit_prefix->text());
|
||||
setActive(ui->checkBox_active->checkState() == Qt::Checked);
|
||||
setStrRedirect(ui->comboBox_redirect->currentText());
|
||||
setRedirect(static_cast<Redirect>(ui->comboBox_redirect->currentIndex()));
|
||||
setInterval(ui->spinBox_interval->value());
|
||||
// filters
|
||||
updateFilter(QString("color"),
|
||||
|
@ -37,7 +37,7 @@ class ExtScript : public AbstractExtItem
|
||||
Q_PROPERTY(Redirect redirect READ redirect WRITE setRedirect)
|
||||
|
||||
public:
|
||||
enum class Redirect { stdout2stderr, nothing, stderr2stdout, swap };
|
||||
enum class Redirect { stdout2stderr = 0, nothing = 1, stderr2stdout = 2, swap = 3 };
|
||||
|
||||
explicit ExtScript(QWidget *parent, const QString filePath = QString());
|
||||
virtual ~ExtScript();
|
||||
|
@ -43,8 +43,6 @@ GraphicalItem::GraphicalItem(QWidget *parent, const QString filePath)
|
||||
ui->setupUi(this);
|
||||
translate();
|
||||
|
||||
initScene();
|
||||
|
||||
connect(ui->checkBox_custom, SIGNAL(stateChanged(int)), this,
|
||||
SLOT(changeValue(int)));
|
||||
connect(ui->comboBox_type, SIGNAL(currentIndexChanged(int)), this,
|
||||
@ -141,6 +139,31 @@ QString GraphicalItem::image(const QVariant &value)
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::initScene()
|
||||
{
|
||||
// cleanup
|
||||
delete m_helper;
|
||||
delete m_scene;
|
||||
|
||||
// init scene
|
||||
m_scene = new QGraphicsScene();
|
||||
m_scene->setBackgroundBrush(QBrush(Qt::NoBrush));
|
||||
// init view
|
||||
m_view = new QGraphicsView(m_scene);
|
||||
m_view->setStyleSheet(QString("background: transparent"));
|
||||
m_view->setContentsMargins(0, 0, 0, 0);
|
||||
m_view->setFrameShape(QFrame::NoFrame);
|
||||
m_view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_view->resize(m_width + 5, m_height + 5);
|
||||
|
||||
// init helper
|
||||
m_helper = new GraphicalItemHelper(this, m_scene);
|
||||
m_helper->setParameters(m_activeColor, m_inactiveColor, m_width, m_height,
|
||||
m_count);
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::bar() const
|
||||
{
|
||||
return m_bar;
|
||||
@ -433,6 +456,7 @@ void GraphicalItem::readConfiguration()
|
||||
settings.endGroup();
|
||||
|
||||
bumpApi(AWGIAPI);
|
||||
initScene();
|
||||
}
|
||||
|
||||
|
||||
@ -489,8 +513,8 @@ int GraphicalItem::showConfiguration(const QVariant args)
|
||||
setMinValue(ui->doubleSpinBox_min->value());
|
||||
setActiveColor(ui->lineEdit_activeColor->text());
|
||||
setInactiveColor(ui->lineEdit_inactiveColor->text());
|
||||
setStrType(ui->comboBox_type->currentText());
|
||||
setStrDirection(ui->comboBox_direction->currentText());
|
||||
setType(static_cast<Type>(ui->comboBox_type->currentIndex()));
|
||||
setDirection(static_cast<Direction>(ui->comboBox_direction->currentIndex()));
|
||||
setItemHeight(ui->spinBox_height->value());
|
||||
setItemWidth(ui->spinBox_width->value());
|
||||
|
||||
@ -590,27 +614,6 @@ void GraphicalItem::changeValue(const int state)
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::initScene()
|
||||
{
|
||||
// init scene
|
||||
m_scene = new QGraphicsScene();
|
||||
m_scene->setBackgroundBrush(QBrush(Qt::NoBrush));
|
||||
// init view
|
||||
m_view = new QGraphicsView(m_scene);
|
||||
m_view->setStyleSheet(QString("background: transparent"));
|
||||
m_view->setContentsMargins(0, 0, 0, 0);
|
||||
m_view->setFrameShape(QFrame::NoFrame);
|
||||
m_view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_view->resize(m_width + 5, m_height + 5);
|
||||
|
||||
// init helper
|
||||
m_helper = new GraphicalItemHelper(this, m_scene);
|
||||
m_helper->setParameters(m_activeColor, m_inactiveColor, m_width, m_height,
|
||||
m_count);
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::translate()
|
||||
{
|
||||
ui->label_name->setText(i18n("Name"));
|
||||
|
@ -50,12 +50,13 @@ class GraphicalItem : public AbstractExtItem
|
||||
|
||||
public:
|
||||
enum class Direction { LeftToRight = 0, RightToLeft = 1 };
|
||||
enum class Type { Horizontal, Vertical, Circle, Graph, Bars };
|
||||
enum class Type { Horizontal = 0, Vertical = 1, Circle = 2, Graph = 3, Bars = 4 };
|
||||
|
||||
explicit GraphicalItem(QWidget *parent, const QString filePath = QString());
|
||||
virtual ~GraphicalItem();
|
||||
GraphicalItem *copy(const QString _fileName, const int _number);
|
||||
QString image(const QVariant &value);
|
||||
void initScene();
|
||||
// get methods
|
||||
QString bar() const;
|
||||
QString activeColor() const;
|
||||
@ -105,7 +106,6 @@ private:
|
||||
QGraphicsScene *m_scene = nullptr;
|
||||
QGraphicsView *m_view = nullptr;
|
||||
Ui::GraphicalItem *ui = nullptr;
|
||||
void initScene();
|
||||
void translate();
|
||||
// properties
|
||||
QString m_bar = QString("cpu");
|
||||
|
@ -21,7 +21,7 @@ set(LIBRARY_TEST_SET ${SUBPROJECT}-awtest ${PROJECT_LIBRARY} ${Qt_LIBRARIES} ${Q
|
||||
## modules
|
||||
set(TEST_MODULES
|
||||
abstractextitem extquotes extscript extupgrade extweather
|
||||
datetimeformatter floatformatter noformatter scriptformatter)
|
||||
abstractformatter datetimeformatter floatformatter noformatter scriptformatter)
|
||||
foreach (TEST_MODULE ${TEST_MODULES})
|
||||
set(${TEST_MODULE}_HEADERS test${TEST_MODULE}.h)
|
||||
set(${TEST_MODULE}_SOURCES test${TEST_MODULE}.cpp)
|
||||
|
67
sources/test/testabstractformatter.cpp
Normal file
67
sources/test/testabstractformatter.cpp
Normal file
@ -0,0 +1,67 @@
|
||||
/***************************************************************************
|
||||
* This file is part of awesome-widgets *
|
||||
* *
|
||||
* awesome-widgets 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 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "testabstractformatter.h"
|
||||
|
||||
#include <QtTest>
|
||||
|
||||
#include "awnoformatter.h"
|
||||
#include "awtestlibrary.h"
|
||||
|
||||
|
||||
void TestAbstractFormatter::initTestCase()
|
||||
{
|
||||
formatter = new AWNoFormatter(nullptr);
|
||||
}
|
||||
|
||||
|
||||
void TestAbstractFormatter::cleanupTestCase()
|
||||
{
|
||||
delete formatter;
|
||||
}
|
||||
|
||||
|
||||
void TestAbstractFormatter::test_values()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void TestAbstractFormatter::test_type()
|
||||
{
|
||||
QString type = AWTestLibrary::randomString();
|
||||
QEXPECT_FAIL("", "Will fail because of invalid format", Continue);
|
||||
formatter->setStrType(type);
|
||||
QCOMPARE(formatter->strType(), type);
|
||||
|
||||
formatter->setStrType(QString("NoFormat"));
|
||||
QCOMPARE(formatter->strType(), QString("NoFormat"));
|
||||
}
|
||||
|
||||
|
||||
void TestAbstractFormatter::test_copy()
|
||||
{
|
||||
AWNoFormatter *newFormatter = formatter->copy(QString("/dev/null"), 1);
|
||||
|
||||
QCOMPARE(newFormatter->type(), formatter->type());
|
||||
QCOMPARE(newFormatter->name(), formatter->name());
|
||||
|
||||
delete newFormatter;
|
||||
}
|
||||
|
||||
|
||||
QTEST_MAIN(TestAbstractFormatter);
|
45
sources/test/testabstractformatter.h
Normal file
45
sources/test/testabstractformatter.h
Normal file
@ -0,0 +1,45 @@
|
||||
/***************************************************************************
|
||||
* This file is part of awesome-widgets *
|
||||
* *
|
||||
* awesome-widgets 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 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef TESTABSTRACTFORMATTER_H
|
||||
#define TESTABSTRACTFORMATTER_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
|
||||
class AWNoFormatter;
|
||||
|
||||
class TestAbstractFormatter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
// initialization
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
// test
|
||||
void test_values();
|
||||
void test_type();
|
||||
void test_copy();
|
||||
|
||||
private:
|
||||
AWNoFormatter *formatter = nullptr;
|
||||
};
|
||||
|
||||
|
||||
#endif /* TESTABSTRACTFORMATTER_H */
|
@ -27,7 +27,8 @@
|
||||
|
||||
void TestAWDateTimeFormatter::initTestCase()
|
||||
{
|
||||
format = AWTestLibrary::randomSelect(QString(TIME_KEYS).split(QChar(','))).join(QChar(' '));
|
||||
format = AWTestLibrary::randomSelect(QString(TIME_KEYS).split(QChar(',')))
|
||||
.join(QChar(' '));
|
||||
|
||||
formatter = new AWDateTimeFormatter(nullptr);
|
||||
formatter->setFormat(format);
|
||||
|
Loading…
Reference in New Issue
Block a user