MCPcopy Create free account
hub / github.com/Audio4Linux/JDSP4Linux / testInsertRows

Method testInsertRows

3rdparty/qtcsv-qt5/tests/testvariantdata.cpp:146–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146void TestVariantData::testInsertRows()
147{
148 double expectedValue = 42.12309;
149 QVariant firstRow(expectedValue);
150
151 QList<QVariant> secondRow;
152 secondRow << QVariant("kkoo") << QVariant(771) << QVariant(3.14);
153
154 QStringList thirdRow;
155 thirdRow << "one" << "two" << "three";
156
157 QString stringOne("hey testing");
158
159 QtCSV::VariantData varData;
160 varData.insertRow(0, firstRow);
161
162 QVERIFY2(1 == varData.rowCount(), "Wrong number of rows");
163 QVERIFY2(1 == varData.rowValues(0).size(),
164 "Wrong number of elements in first row");
165
166 double diff = expectedValue - varData.rowValues(0).at(0).toDouble();
167 QVERIFY2(diff <= EPSILON, "Wrong number in first row");
168
169 varData.addEmptyRow();
170 varData.addRow(stringOne);
171 varData.insertRow(1, secondRow);
172 varData.insertRow(100, thirdRow);
173
174 QVERIFY2(5 == varData.rowCount(), "Wrong number of rows");
175
176 diff = expectedValue - varData.rowValues(0).at(0).toDouble();
177 QVERIFY2(diff <= EPSILON, "Wrong data for first row");
178
179 QStringList resultSecondRow = varData.rowValues(1);
180 QVERIFY2(secondRow.at(0).toString() == resultSecondRow.at(0) &&
181 secondRow.at(1).toString() == resultSecondRow.at(1) &&
182 secondRow.at(2).toString() == resultSecondRow.at(2),
183 "Wrong data for second row");
184
185 QVERIFY2(QStringList() == varData.rowValues(2),
186 "Wrong data for third row");
187
188 QVERIFY2((QStringList() << stringOne) == varData.rowValues(3),
189 "Wrong data for fourth row");
190
191 QVERIFY2(thirdRow == varData.rowValues(4), "Wrong data for fifth row");
192}
193
194void TestVariantData::testCompareForEquality()
195{

Callers

nothing calls this directly

Calls 9

QVariantClass · 0.50
QStringListClass · 0.50
insertRowMethod · 0.45
rowCountMethod · 0.45
sizeMethod · 0.45
rowValuesMethod · 0.45
atMethod · 0.45
addEmptyRowMethod · 0.45
addRowMethod · 0.45

Tested by

no test coverage detected