const Date beforeDate(Date::SYSTEM); constdouble beforeTime = tools::Time(tools::Time::SYSTEM).GetTimeInDays();
// in cell A1, insert the date
CPPUNIT_ASSERT(activateMenuItem(u"Insert", u"Date")); // move down to A2
documentPostKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, css::awt::Key::DOWN); // in cell A2, insert the time
CPPUNIT_ASSERT(activateMenuItem(u"Insert", u"Time"));
/* As it's very tricky to check the dates and times are correct in text format (imagine running *on1970-12-3123:59:59.99,it'sgonnashift*everything*ina100thofasecond)because *clockcanhavechangedbetweengeneratingthetwovaluestocompare.Soinsteadwejust *checkthetextisnotempty,andtheunderlyingvalue(representingthedateortime)is
* between the time it was before and after the call. */
// cell A2 contains time, no date, so we have to be careful passing midnight
xCell = sheet->getAccessibleCellAt(1, 0)->getAccessibleContext();
xText.set(xCell, uno::UNO_QUERY_THROW);
std::cout << "A2 (text): " << xText->getText() << std::endl;
CPPUNIT_ASSERT(!xText->getText().isEmpty());
xValue.set(xCell, uno::UNO_QUERY_THROW);
CPPUNIT_ASSERT(xValue->getCurrentValue() >>= value);
std::cout << "A2 (value): " << value << std::endl; double afterTime = tools::Time(tools::Time::SYSTEM).GetTimeInDays(); // in case day changed -- assuming no more than 24 hours passed if (afterTime < beforeTime)
{
afterTime += 1; if (value < beforeTime)
value += 1;
}
CPPUNIT_ASSERT_GREATEREQUAL(beforeTime, value);
CPPUNIT_ASSERT_LESSEQUAL(afterTime, value);
}
// test that converting cell row/col number <-> child index works // for the case where 32-bit a11y child indices don't suffice (tdf#150683)
CPPUNIT_TEST_FIXTURE(test::AccessibleTestBase, Test64BitChildIndices)
{
load(u"private:factory/scalc"_ustr);
uno::Reference<accessibility::XAccessible> xCell = xTable->getAccessibleCellAt(nRow, nCol); const sal_Int64 nChildIndex = xCell->getAccessibleContext()->getAccessibleIndexInParent(); // child index should be positive for all cells except the first one (A1)
CPPUNIT_ASSERT_GREATER(sal_Int64(0), nChildIndex);
// test that retrieving the row and column number via the child index again works
CPPUNIT_ASSERT_EQUAL(nRow, xTable->getAccessibleRow(nChildIndex));
CPPUNIT_ASSERT_EQUAL(nCol, xTable->getAccessibleColumn(nChildIndex));
}
uno::Reference<accessibility::XAccessible> xCell = sheet->getAccessibleCellAt(1, 1);
CPPUNIT_ASSERT(xCell);
uno::WeakReference<accessibility::XAccessible> xCellWeak(xCell);
xCell.clear(); // Verify that there are no reference cycles and that the ScAccessibleCell object dies after we // are done with it.
uno::Reference<accessibility::XAccessible> xCell2(xCellWeak);
CPPUNIT_ASSERT(!xCell2.is());
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.