fix: test build fail duo invalid skip & take values;
This commit is contained in:
parent
e265b3ad02
commit
38e43dc61a
|
|
@ -65,7 +65,7 @@ jobs:
|
||||||
${{steps.qt.outputs.make}}
|
${{steps.qt.outputs.make}}
|
||||||
${{steps.qt.outputs.make}} INSTALL_ROOT="${{steps.qt.outputs.installdir}}" install
|
${{steps.qt.outputs.make}} INSTALL_ROOT="${{steps.qt.outputs.installdir}}" install
|
||||||
- name: make tests
|
- name: make tests
|
||||||
if: steps.qt.outputs.tests == 'true' && !contains(matrix.platform, 'mingw')
|
if: steps.qt.outputs.tests == 'true'
|
||||||
run: |
|
run: |
|
||||||
${{steps.qt.outputs.make}} all
|
${{steps.qt.outputs.make}} all
|
||||||
${{steps.qt.outputs.make}} ${{steps.qt.outputs.testflags}} run-tests
|
${{steps.qt.outputs.make}} ${{steps.qt.outputs.testflags}} run-tests
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ AbstractQuery::AbstractQuery(QObject *parent) : QObject(parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
Nut::AbstractQueryPrivate::AbstractQueryPrivate(Nut::AbstractQuery *parent) :
|
Nut::AbstractQueryPrivate::AbstractQueryPrivate(Nut::AbstractQuery *parent) :
|
||||||
q_ptr(parent)
|
q_ptr(parent), skip(0), take(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,8 @@
|
||||||
|
|
||||||
|
|
||||||
#define DRIVER QStringLiteral("QSQLITE")
|
#define DRIVER QStringLiteral("QSQLITE")
|
||||||
#define DATABASE QStringLiteral("nut_test_%1_db").arg(metaObject()->className()).toLower()
|
#define DATABASE QStringLiteral("nut_test_%1_db") \
|
||||||
|
.arg(QString::fromUtf8(metaObject()->className())).toLower()
|
||||||
#define HOST QString()
|
#define HOST QString()
|
||||||
#define USERNAME QString()
|
#define USERNAME QString()
|
||||||
#define PASSWORD QString()
|
#define PASSWORD QString()
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ void BasicTest::createPost2()
|
||||||
{
|
{
|
||||||
//create post on the fly
|
//create post on the fly
|
||||||
QVariant postIdVar = db.posts()->query()->insert(
|
QVariant postIdVar = db.posts()->query()->insert(
|
||||||
(Post::titleField() = "This is a sample")
|
(Post::titleField() = QStringLiteral("This is a sample"))
|
||||||
& (Post::isPublicField() = true));
|
& (Post::isPublicField() = true));
|
||||||
|
|
||||||
QVERIFY(postIdVar.type() == QVariant::LongLong
|
QVERIFY(postIdVar.type() == QVariant::LongLong
|
||||||
|
|
@ -108,7 +108,7 @@ void BasicTest::createPost2()
|
||||||
|
|
||||||
for(int i = 0 ; i < 3; i++){
|
for(int i = 0 ; i < 3; i++){
|
||||||
auto comment = Nut::create<Comment>();
|
auto comment = Nut::create<Comment>();
|
||||||
comment->setMessage("comment #" + QString::number(i + 2));
|
comment->setMessage(QStringLiteral("comment #") + QString::number(i + 2));
|
||||||
comment->setSaveDate(QDateTime::currentDateTime());
|
comment->setSaveDate(QDateTime::currentDateTime());
|
||||||
comment->setAuthor(user);
|
comment->setAuthor(user);
|
||||||
//join child to master by id
|
//join child to master by id
|
||||||
|
|
@ -124,9 +124,17 @@ void BasicTest::updatePostOnTheFly()
|
||||||
{
|
{
|
||||||
auto c = db.posts()->query()
|
auto c = db.posts()->query()
|
||||||
->where(Post::idField() == postId)
|
->where(Post::idField() == postId)
|
||||||
->update(Post::titleField() = "New title");
|
->update(Post::titleField() = QStringLiteral("New title"));
|
||||||
|
|
||||||
QCOMPARE(c, 1);
|
QCOMPARE(c, 1);
|
||||||
|
|
||||||
|
auto titles = db.posts()
|
||||||
|
->query()
|
||||||
|
->where(Post::idField() == postId)
|
||||||
|
->select(Post::titleField());
|
||||||
|
|
||||||
|
QCOMPARE(titles.count(), 1);
|
||||||
|
QCOMPARE(titles.at(0), QStringLiteral("New title"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasicTest::selectPublicts()
|
void BasicTest::selectPublicts()
|
||||||
|
|
@ -224,7 +232,7 @@ void BasicTest::testDate()
|
||||||
d.setTime(t);
|
d.setTime(t);
|
||||||
|
|
||||||
auto newPost = Nut::create<Post>();
|
auto newPost = Nut::create<Post>();
|
||||||
newPost->setTitle("post title");
|
newPost->setTitle(QStringLiteral("post title"));
|
||||||
newPost->setSaveDate(d);
|
newPost->setSaveDate(d);
|
||||||
|
|
||||||
db.posts()->append(newPost);
|
db.posts()->append(newPost);
|
||||||
|
|
@ -241,7 +249,9 @@ void BasicTest::testDate()
|
||||||
|
|
||||||
void BasicTest::testLimitedQuery()
|
void BasicTest::testLimitedQuery()
|
||||||
{
|
{
|
||||||
auto comments = db.comments()->query()->toList(2);
|
auto q = db.comments()->query();
|
||||||
|
auto comments = q->toList(2);
|
||||||
|
qDebug() << q->sqlCommand();
|
||||||
QCOMPARE(comments.length(), 2);
|
QCOMPARE(comments.length(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ void BenchmarkTest::insert1kPost()
|
||||||
|
|
||||||
for (int i = 0; i < 100; ++i) {
|
for (int i = 0; i < 100; ++i) {
|
||||||
auto newPost = Nut::create<Post>();
|
auto newPost = Nut::create<Post>();
|
||||||
newPost->setTitle("post title");
|
newPost->setTitle(QStringLiteral("post title"));
|
||||||
newPost->setSaveDate(QDateTime::currentDateTime());
|
newPost->setSaveDate(QDateTime::currentDateTime());
|
||||||
|
|
||||||
db.posts()->append(newPost);
|
db.posts()->append(newPost);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue