~ubuntu-branches/ubuntu/utopic/libkdeedu/utopic-proposed

« back to all changes in this revision

Viewing changes to keduvocdocument/tests/keduvocdocumentvalidatortest.cpp

  • Committer: Package Import Robot
  • Author(s): Scarlett Clark
  • Date: 2014-07-24 23:35:22 UTC
  • mfrom: (1.1.47)
  • Revision ID: package-import@ubuntu.com-20140724233522-1e4ubec6x9v41r1l
Tags: 4:4.13.90-0ubuntu1
New upstream beta release

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
    doc.setTitle( title );
74
74
 
75
75
    doc.saveAs(fileName, KEduVocDocument::Kvtml, generator);
 
76
    doc.close();
76
77
 
77
78
    KEduVocDocument docRead;
78
79
    docRead.open(fileName);
87
88
 
88
89
void KEduVocDocumentValidatorTest::testLessons()
89
90
{
 
91
    const QString title = QString::fromLatin1( "Validator Test Title" );
 
92
    QString lesson0 = QString::fromLatin1( "Lesson Root" );
90
93
    QString lesson1 = QString::fromLatin1( "Lesson 1" );
91
94
    QString lesson1child1 = QString::fromLatin1( "Lesson 1.1" );
92
95
    QString lesson1child2 = QString::fromLatin1( "Lesson 1.2" );
95
98
 
96
99
    KEduVocDocument doc;
97
100
    doc.lesson()->appendChildContainer(new KEduVocLesson(lesson1, doc.lesson()));
 
101
    // Order here is significant as setTitle also sets the lesson name.
 
102
    doc.lesson()->setName( lesson0 );
 
103
    doc.setTitle( title );
98
104
    QCOMPARE(doc.lesson()->childContainerCount(), 1);
99
105
    QCOMPARE(doc.lesson()->childContainer(0)->containerType(), KEduVocContainer::Lesson);
100
106
    QCOMPARE(doc.lesson()->childContainer(0)->parent(), doc.lesson());
101
107
    QCOMPARE(doc.lesson()->childContainer(0)->name(), lesson1);
102
108
 
 
109
    ///@todo decouple document and root lesson title
 
110
    QEXPECT_FAIL("",  "Document and root lesson have the same name",  Continue);
 
111
    QCOMPARE(doc.lesson()->name(), lesson0);
 
112
    QCOMPARE( doc.title(), title );
 
113
 
103
114
    doc.lesson()->appendChildContainer(new KEduVocLesson(lesson2, doc.lesson()));
104
115
    doc.lesson()->appendChildContainer(new KEduVocLesson(lesson3, doc.lesson()));
105
116
    QCOMPARE(doc.lesson()->childContainerCount(), 3);