Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision b503a9ac

Von Christian Ehringfeld vor etwa 7 Jahren hinzugefügt

  • ID b503a9ac84630d893c03b2c2f5b6833303600475
  • Vorgänger cbfd2b95
  • Nachfolger c88e17d1

fix

Unterschiede anzeigen:

src/entitymanager.cpp
name += QString::number(i) + "]";
break;
}
++i;
}
return name;
}
......
auto ptr = QSharedPointer<Entity>(EntityInstanceFactory::createInstance(
EntityInstanceFactory::extractEntityType(QString(property.typeName()))));
auto builder = this->schema->getQueryBuilder();
QString tblName = builder->generateManyToManyTableName(ptr, entity, r);
QString tblName = builder->generateManyToManyTableName(entity, ptr, r);
if (this->schema->containsTable(tblName)) {
bool ok = newItem;
QSqlQuery q;
tests/em/tst_em.cpp
#include "tst_em.h"
//void EmTest::initTestCase() {
// CuteEntityManager::EntityInstanceFactory::registerClass<Group>();
// CuteEntityManager::EntityInstanceFactory::registerClass<Person>();
// CuteEntityManager::EntityInstanceFactory::registerClass<Article>();
// CuteEntityManager::EntityInstanceFactory::registerClass<Employee>();
// CuteEntityManager::EntityInstanceFactory::registerClass<WorkerGroup>();
// this->e = new CuteEntityManager::EntityManager("QSQLITE",
// ":memory:", "", "", "", "", true, "foreign_keys = ON", false);
//}
void EmTest::initTestCase() {
CuteEntityManager::EntityInstanceFactory::registerClass<Group>();
CuteEntityManager::EntityInstanceFactory::registerClass<Person>();
CuteEntityManager::EntityInstanceFactory::registerClass<Article>();
CuteEntityManager::EntityInstanceFactory::registerClass<Employee>();
CuteEntityManager::EntityInstanceFactory::registerClass<WorkerGroup>();
this->e = new CuteEntityManager::EntityManager("QSQLITE",
":memory:", "", "", "", "", true, "foreign_keys = ON", false,MsgType::DEBUG);
QStringList inits = QStringList() << "Article" << "Group" << "Person" << "Employee" << "WorkerGroup";
e->startup("0.1", inits);
}
//void EmTest::cleanupTestCase() {
// if (this->e) {
// delete this->e;
// this->e = nullptr;
// }
//}
void EmTest::cleanupTestCase() {
if (this->e) {
delete this->e;
this->e = nullptr;
}
}
void EmTest::testCheckDuplicates() {
QSharedPointer<Article> article = QSharedPointer<Article>(new Article(10,
......
QSharedPointer<Person> p = QSharedPointer<Person>(new Person("Patrick", "De",
Person::Gender::MALE, "Pat", QDate(2000, 1, 1)));
auto ent = p.objectCast<Entity>();
try {
QVERIFY(this->e->create(ent));
auto id = p->getId();
QVERIFY(id > -1);
QVERIFY(this->e->findById(id, p->getClassname()));
} catch(QString ex) {
qDebug() << "------------------------------";
qDebug() << ex;
qDebug() << "------------------------------";
}
}
void EmTest::testFindByIdOnNull()
tests/em/tst_em.h
Q_OBJECT
private Q_SLOTS:
// void initTestCase();
// void cleanupTestCase();
void initTestCase();
void cleanupTestCase();
void testCheckDuplicates();
void testBasics();
void init();
tests/validators/tst_validatorstest.moc
/****************************************************************************
** Meta object code from reading C++ file 'tst_validatorstest.cpp'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'tst_validatorstest.cpp' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.8.0. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
struct qt_meta_stringdata_ValidatorsTest_t {
QByteArrayData data[6];
char stringdata0[70];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_ValidatorsTest_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_ValidatorsTest_t qt_meta_stringdata_ValidatorsTest = {
{
QT_MOC_LITERAL(0, 0, 14), // "ValidatorsTest"
QT_MOC_LITERAL(1, 15, 12), // "initTestCase"
QT_MOC_LITERAL(2, 28, 0), // ""
QT_MOC_LITERAL(3, 29, 15), // "cleanupTestCase"
QT_MOC_LITERAL(4, 45, 14), // "testCase1_data"
QT_MOC_LITERAL(5, 60, 9) // "testCase1"
},
"ValidatorsTest\0initTestCase\0\0"
"cleanupTestCase\0testCase1_data\0testCase1"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_ValidatorsTest[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
4, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: name, argc, parameters, tag, flags
1, 0, 34, 2, 0x08 /* Private */,
3, 0, 35, 2, 0x08 /* Private */,
4, 0, 36, 2, 0x08 /* Private */,
5, 0, 37, 2, 0x08 /* Private */,
// slots: parameters
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
0 // eod
};
void ValidatorsTest::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
ValidatorsTest *_t = static_cast<ValidatorsTest *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->initTestCase(); break;
case 1: _t->cleanupTestCase(); break;
case 2: _t->testCase1_data(); break;
case 3: _t->testCase1(); break;
default: ;
}
}
Q_UNUSED(_a);
}
const QMetaObject ValidatorsTest::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_ValidatorsTest.data,
qt_meta_data_ValidatorsTest, qt_static_metacall, Q_NULLPTR, Q_NULLPTR}
};
const QMetaObject *ValidatorsTest::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *ValidatorsTest::qt_metacast(const char *_clname)
{
if (!_clname) return Q_NULLPTR;
if (!strcmp(_clname, qt_meta_stringdata_ValidatorsTest.stringdata0))
return static_cast<void*>(const_cast< ValidatorsTest*>(this));
return QObject::qt_metacast(_clname);
}
int ValidatorsTest::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 4)
qt_static_metacall(this, _c, _id, _a);
_id -= 4;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 4)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 4;
}
return _id;
}
QT_WARNING_POP
QT_END_MOC_NAMESPACE

Auch abrufbar als: Unified diff