~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to plugins/textshape/tests/TestSections.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-21 15:36:35 UTC
  • mfrom: (1.4.1 upstream) (60.2.11 maverick)
  • Revision ID: james.westby@ubuntu.com-20100921153635-6tejqkiro2u21ydi
Tags: 1:2.2.2-0ubuntu3
Add kubuntu_03_fix-crash-on-closing-sqlite-connection-2.2.2.diff and
kubuntu_04_support-large-memo-values-for-msaccess-2.2.2.diff as
recommended by upstream http://kexi-
project.org/wiki/wikiview/index.php@Kexi2.2_Patches.html#sqlite_stab
ility

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef TESTSECTIONS_H
 
2
#define TESTSECTIONS_H
 
3
 
 
4
#include <QObject>
 
5
#include <QString>
 
6
#include <qtest_kde.h>
 
7
 
 
8
#include "../Layout.h"
 
9
#include "../TextShape.h"
 
10
 
 
11
class MockTextShape;
 
12
class KoTextDocumentLayout;
 
13
class KoSectionStyle;
 
14
class KoStyleManager;
 
15
class QTextDocument;
 
16
class QTextFrame;
 
17
 
 
18
class TestSections : public QObject
 
19
{
 
20
    Q_OBJECT
 
21
 
 
22
public:
 
23
    TestSections() {}
 
24
 
 
25
private:
 
26
    /**
 
27
     * Initialize for a new test.
 
28
     *
 
29
     * @param sectionStyles a list of section styles to use.
 
30
     */
 
31
    void initTest(const KoSectionStyle *sectionStyles);
 
32
 
 
33
    /**
 
34
     * Initialize for a new test. Simplified version.
 
35
     *
 
36
     * @param sectionStyle the section style to use.
 
37
     */
 
38
    void initTestSimple(KoSectionStyle *sectionStyle);
 
39
 
 
40
    /// Clean up after a test.
 
41
    void cleanupTest();
 
42
 
 
43
private slots:
 
44
    /// Common initialization for all tests.
 
45
    void init();
 
46
    /// Test very basic layout functionality.
 
47
    void testBasicLayout();
 
48
    /// Test table padding.
 
49
    void testShrinkByMargin();
 
50
    /// Test table padding.
 
51
    void testMoveByMargin();
 
52
 
 
53
private:
 
54
    QTextDocument *m_doc;
 
55
    QTextTable *m_table;
 
56
    KoTextDocumentLayout *m_layout;
 
57
    KoStyleManager *m_styleManager;
 
58
    Layout *m_textLayout;
 
59
    MockTextShape *m_shape;
 
60
 
 
61
    // Default styles for the test.
 
62
    KoSectionStyle *m_defaultSectionStyle;
 
63
};
 
64
 
 
65
class MockTextShape : public TextShape
 
66
{
 
67
public:
 
68
    MockTextShape() : TextShape(0)
 
69
    {
 
70
        layout = qobject_cast<KoTextDocumentLayout*>(textShapeData()->document()->documentLayout());
 
71
    }
 
72
    void paint(QPainter &painter, const KoViewConverter &converter)
 
73
    {
 
74
        Q_UNUSED(painter);
 
75
        Q_UNUSED(converter);
 
76
    }
 
77
    virtual void saveOdf(KoShapeSavingContext &) const {}
 
78
    virtual bool loadOdf(const KoXmlElement &, KoShapeLoadingContext &) {
 
79
        return true;
 
80
    }
 
81
    KoTextDocumentLayout *layout;
 
82
};
 
83
 
 
84
#endif // TESTSECTIONS_H