本文整理汇总了C++中incidence::Ptr::allDay方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::allDay方法的具体用法?C++ Ptr::allDay怎么用?C++ Ptr::allDay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类incidence::Ptr
的用法示例。
在下文中一共展示了Ptr::allDay方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calendar
void DndFactoryTest::testPasteAllDayEvent2()
{
MemoryCalendar::Ptr calendar( new MemoryCalendar( QString() ) );
DndFactory factory( calendar );
Event::Ptr allDayEvent( new Event() );
allDayEvent->setSummary( QLatin1String( "Summary 2" ) );
allDayEvent->setDtStart( KDateTime( QDate( 2010, 8, 8 ) ) );
allDayEvent->setDtEnd( KDateTime( QDate( 2010, 8, 9 ) ) );
const QString originalUid = allDayEvent->uid();
Incidence::List incidencesToPaste;
incidencesToPaste.append( allDayEvent );
QVERIFY( factory.copyIncidences( incidencesToPaste ) );
const KDateTime newDateTime( QDate( 2011, 1, 1 ) );
const uint originalLength = allDayEvent->dtStart().secsTo( allDayEvent->dtEnd() );
// paste at the new time
Incidence::List pastedIncidences = factory.pasteIncidences( newDateTime );
// we only copied one incidence
QVERIFY( pastedIncidences.size() == 1 );
Incidence::Ptr incidence = pastedIncidences.first();
QVERIFY( incidence->type() == Incidence::TypeEvent );
// check if a new uid was generated.
QVERIFY( incidence->uid() != originalUid );
// the new dateTime didn't have time component
QVERIFY( incidence->allDay() );
Event::Ptr pastedEvent = incidence.staticCast<Event>();
const uint newLength = pastedEvent->dtStart().secsTo( pastedEvent->dtEnd() );
kDebug() << "originalLength was " << originalLength << "; and newLength is "
<< newLength << "; old dtStart was " << allDayEvent->dtStart()
<< " and old dtEnd was " << allDayEvent->dtEnd() << endl
<< "; new dtStart is " << pastedEvent->dtStart()
<< " and new dtEnd is " << pastedEvent->dtEnd();
QVERIFY( originalLength == newLength );
QVERIFY( pastedEvent->dtStart() == newDateTime );
QVERIFY( pastedEvent->summary() == allDayEvent->summary() );
}
示例2: testPasteAllDayEvent
void DndFactoryTest::testPasteAllDayEvent()
{
MemoryCalendar::Ptr calendar( new MemoryCalendar( QString() ) );
DndFactory factory( calendar );
Event::Ptr allDayEvent( new Event() );
allDayEvent->setSummary( QLatin1String( "Summary 1" ) );
allDayEvent->setDtStart( KDateTime( QDate( 2010, 8, 8 ) ) );
allDayEvent->setDtEnd( KDateTime( QDate( 2010, 8, 9 ) ) );
const QString originalUid = allDayEvent->uid();
const bool originalIsAllDay = allDayEvent->allDay();
Incidence::List incidencesToPaste;
incidencesToPaste.append( allDayEvent );
QVERIFY( factory.copyIncidences( incidencesToPaste ) );
Incidence::List pastedIncidences = factory.pasteIncidences();
QVERIFY( pastedIncidences.size() == 1 );
Incidence::Ptr incidence = pastedIncidences.first();
QVERIFY( incidence->type() == Incidence::TypeEvent );
// check if a new uid was generated.
QVERIFY( incidence->uid() != originalUid );
// we passed an invalid KDateTime to pasteIncidences() so dates don't change.
QVERIFY( incidence->allDay() == originalIsAllDay );
Event::Ptr pastedEvent = incidence.staticCast<Event>();
QVERIFY( pastedEvent->dtStart() == allDayEvent->dtStart() );
QVERIFY( pastedEvent->dtEnd() == allDayEvent->dtEnd() );
QVERIFY( pastedEvent->summary() == allDayEvent->summary() );
}