| 763 | ////////////////////////////////////////////////// |
| 764 | |
| 765 | void ColumnTest::saveLoadDateTime() { |
| 766 | Column c(QStringLiteral("Datetime column"), Column::ColumnMode::DateTime); |
| 767 | c.setDateTimes({ |
| 768 | QDateTime::fromString( |
| 769 | QStringLiteral("2017-03-26T02:14:34.000Z"), |
| 770 | Qt::DateFormat::ISODateWithMs), // without the timezone declaration it would be invalid (in some regions), because of the daylight time |
| 771 | QDateTime::fromString(QStringLiteral("2018-03-26T02:14:34.000Z"), Qt::DateFormat::ISODateWithMs), |
| 772 | QDateTime::fromString(QStringLiteral("2019-03-26T02:14:34.000Z"), Qt::DateFormat::ISODateWithMs), |
| 773 | QDateTime::fromString(QStringLiteral("2019-26-03 02:14:34:000"), QStringLiteral("yyyy-dd-MM hh:mm:ss:zzz")), |
| 774 | }); |
| 775 | |
| 776 | QByteArray array; |
| 777 | QXmlStreamWriter writer(&array); |
| 778 | c.save(&writer); |
| 779 | |
| 780 | QDEBUG(array); |
| 781 | |
| 782 | Column c2(QStringLiteral("Datetime 2 column"), Column::ColumnMode::DateTime); |
| 783 | XmlStreamReader reader(array); |
| 784 | bool found = false; |
| 785 | while (!reader.atEnd()) { |
| 786 | reader.readNext(); |
| 787 | if (reader.isStartElement() && reader.name() == QLatin1String("column")) { |
| 788 | found = true; |
| 789 | break; |
| 790 | } |
| 791 | } |
| 792 | QCOMPARE(found, true); |
| 793 | QCOMPARE(c2.load(&reader, false), true); |
| 794 | |
| 795 | QCOMPARE(c2.rowCount(), 4); |
| 796 | QCOMPARE(c2.dateTimeAt(0).isValid(), true); |
| 797 | QCOMPARE(c2.dateTimeAt(0), QDateTime::fromString(QStringLiteral("2017-03-26T02:14:34.000Z"), Qt::DateFormat::ISODateWithMs)); |
| 798 | QCOMPARE(c2.dateTimeAt(1).isValid(), true); |
| 799 | QCOMPARE(c2.dateTimeAt(1), QDateTime::fromString(QStringLiteral("2018-03-26T02:14:34.000Z"), Qt::DateFormat::ISODateWithMs)); |
| 800 | QCOMPARE(c2.dateTimeAt(2).isValid(), true); |
| 801 | QCOMPARE(c2.dateTimeAt(2), QDateTime::fromString(QStringLiteral("2019-03-26T02:14:34.000Z"), Qt::DateFormat::ISODateWithMs)); |
| 802 | QCOMPARE(c2.dateTimeAt(3).isValid(), true); |
| 803 | QCOMPARE(c2.dateTimeAt(3), QDateTime::fromString(QStringLiteral("2019-03-26T02:14:34.000Z"), Qt::DateFormat::ISODateWithMs)); |
| 804 | } |
| 805 | |
| 806 | void ColumnTest::loadDoubleFromProject() { |
| 807 | Project project; |
nothing calls this directly
no test coverage detected