Commit d0a345cd authored by Tomas Mecir's avatar Tomas Mecir
Browse files

Some fixes to regions and saving.

parent 58d9dc62
Pipeline #185441 passed with stage
in 24 minutes and 25 seconds
......@@ -1124,7 +1124,10 @@ void Odf::saveColRowCell(Sheet *sheet, int maxCols, int maxRows, OdfSavingContex
while (j <= maxCols) {
j++;
if (!cf->colsAreEqual(i, j)) break;
if (j > cf->lastNonDefaultCol()) break;
if (j > cf->lastNonDefaultCol()) {
count = maxCols - i + 1; // grab everything that is left
break;
}
if (style != tableContext.columnDefaultStyles.value(j)) break;
++count;
}
......@@ -1316,7 +1319,6 @@ void Odf::saveCells(Sheet *sheet, int row, int maxCols, OdfSavingContext& tableC
// debugSheetsODF <<"Odf::saveCells:"
// << " i: " << i
// << " column: " << cell.column() << endl;
int repeated = 1;
int column = i;
saveCell(&cell, repeated, tableContext);
......
......@@ -667,6 +667,7 @@ QRect Region::boundingRect() const
int right = 1;
int top = KS_rowMax;
int bottom = 1;
if (isEmpty()) return QRect();
Region::ConstIterator endOfList = cells().constEnd();
for (Region::ConstIterator it = cells().constBegin(); it != endOfList; ++it) {
QRect range = (*it)->rect();
......
......@@ -131,6 +131,30 @@ void TestRegion::testExtrem()
QCOMPARE(region6.name(), region7.name());
}
void TestRegion::testOps()
{
Region empty = Region();
int rownum = 4;
Region row = Region(QRect(QPoint(1, rownum), QPoint(KS_colMax, rownum)));
Region a1 = row.intersected(empty);
QVERIFY(a1.isEmpty());
Region rect = Region(QRect(QPoint(3,3), QPoint(5,5)));
Region a2 = row.intersected(rect);
Region a3 = rect.intersected(row);
QVERIFY(a2 == a3);
Region smallrect = Region(QRect(QPoint(3,4), QPoint(5,4)));
QVERIFY(a2 == smallrect);
QVERIFY(row.isRowSelected(rownum));
QVERIFY(row.isColumnOrRowSelected());
QVERIFY(row.contains(QPoint(789,rownum)));
QVERIFY(!row.contains(QPoint(789,rownum+1)));
QRect bound = empty.boundingRect();
QVERIFY(bound == QRect());
}
void TestRegion::cleanupTestCase()
{
delete m_map;
......
......@@ -23,6 +23,7 @@ private Q_SLOTS:
void testFixation();
void testSheet();
void testExtrem();
void testOps();
void cleanupTestCase();
private:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment