annotationtoolbartest.cpp 17.5 KB
Newer Older
Simone Gaiarin's avatar
Simone Gaiarin committed
1
2
3
4
5
6
7
8
9
10
11
12
13
/***************************************************************************
 *   Copyright (C) 2020 by Simone Gaiarin <simgunz@gmail.com>              *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/

// clazy:excludeall=qstring-allocations

#include <QtTest>

Albert Astals Cid's avatar
Albert Astals Cid committed
14
#include <KActionCollection>
Simone Gaiarin's avatar
Simone Gaiarin committed
15
16
17
#include <QTabBar>
#include <QTabWidget>
#include <QToolBar>
Albert Astals Cid's avatar
Albert Astals Cid committed
18
#include <QWidget>
Simone Gaiarin's avatar
Simone Gaiarin committed
19

20
21
#include <KSelectAction>

Albert Astals Cid's avatar
Albert Astals Cid committed
22
23
24
#include "../core/page.h"
#include "../part.h"
#include "../settings.h"
Simone Gaiarin's avatar
Simone Gaiarin committed
25
26
27
28
#include "../shell/okular_main.h"
#include "../shell/shell.h"
#include "../shell/shellutils.h"
#include "../ui/pageview.h"
29
#include "closedialoghelper.h"
Simone Gaiarin's avatar
Simone Gaiarin committed
30

Albert Astals Cid's avatar
Albert Astals Cid committed
31
32
namespace Okular
{
Simone Gaiarin's avatar
Simone Gaiarin committed
33
34
35
class PartTest
{
public:
Albert Astals Cid's avatar
Albert Astals Cid committed
36
37
    Okular::Document *partDocument(Okular::Part *part) const
    {
Simone Gaiarin's avatar
Simone Gaiarin committed
38
39
        return part->m_document;
    }
Albert Astals Cid's avatar
Albert Astals Cid committed
40
41
    PageView *pageView(Okular::Part *part) const
    {
Simone Gaiarin's avatar
Simone Gaiarin committed
42
43
44
45
46
47
48
49
50
51
52
        return part->m_pageView;
    }
};
}

class AnnotationToolBarTest : public QObject, public Okular::PartTest
{
    Q_OBJECT

public:
    static void initMain();
Albert Astals Cid's avatar
Albert Astals Cid committed
53
    static QTabWidget *tabWidget(Shell *s)
Simone Gaiarin's avatar
Simone Gaiarin committed
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
    {
        return s->m_tabWidget;
    }

private slots:
    void initTestCase();
    void init();
    void cleanup();

    void testAnnotationToolBar();
    void testAnnotationToolBar_data();
    void testAnnotationToolBarActionsEnabledState();
    void testAnnotationToolBarActionsEnabledState_data();
    void testAnnotationToolBarConfigActionsEnabledState();
    void testAnnotationToolBarConfigActionsEnabledState_data();

private:
Albert Astals Cid's avatar
Albert Astals Cid committed
71
    bool simulateAddPopupAnnotation(Okular::Part *part, int mouseX, int mouseY);
Simone Gaiarin's avatar
Simone Gaiarin committed
72
73
74
75
76
};

Shell *findShell(Shell *ignore = nullptr)
{
    const QWidgetList wList = QApplication::topLevelWidgets();
Albert Astals Cid's avatar
Albert Astals Cid committed
77
78
    for (QWidget *widget : wList) {
        Shell *s = qobject_cast<Shell *>(widget);
Simone Gaiarin's avatar
Simone Gaiarin committed
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
        if (s && s != ignore)
            return s;
    }
    return nullptr;
}

void AnnotationToolBarTest::initMain()
{
    // Ensure consistent configs/caches and Default UI
    QTemporaryDir homeDir;
    Q_ASSERT(homeDir.isValid());
    QByteArray homePath = QFile::encodeName(homeDir.path());
    qputenv("USERPROFILE", homePath);
    qputenv("HOME", homePath);
    qputenv("XDG_DATA_HOME", homePath + "/.local");
    qputenv("XDG_CONFIG_HOME", homePath + "/.kde-unit-test/xdg/config");
}

void AnnotationToolBarTest::initTestCase()
{
    QStandardPaths::setTestModeEnabled(true);
    // Don't pollute people's okular settings
Albert Astals Cid's avatar
Albert Astals Cid committed
101
    Okular::Settings::instance(QStringLiteral("annotationtoolbartest"));
Simone Gaiarin's avatar
Simone Gaiarin committed
102
103
104
105
106
107
108
109
110
111
112
}

void AnnotationToolBarTest::init()
{
    // Default settings for every test
    Okular::Settings::self()->setDefaults();
}

void AnnotationToolBarTest::cleanup()
{
    Shell *s;
Albert Astals Cid's avatar
Albert Astals Cid committed
113
    while ((s = findShell())) {
Simone Gaiarin's avatar
Simone Gaiarin committed
114
115
116
117
        delete s;
    }
}

Albert Astals Cid's avatar
Albert Astals Cid committed
118
bool AnnotationToolBarTest::simulateAddPopupAnnotation(Okular::Part *part, int mouseX, int mouseY)
Simone Gaiarin's avatar
Simone Gaiarin committed
119
{
Albert Astals Cid's avatar
Albert Astals Cid committed
120
    int annotationCount = partDocument(part)->page(0)->annotations().size();
Simone Gaiarin's avatar
Simone Gaiarin committed
121
122
    QTest::mouseMove(pageView(part)->viewport(), QPoint(mouseX, mouseY));
    QTest::mouseClick(pageView(part)->viewport(), Qt::LeftButton, Qt::NoModifier, QPoint(mouseX, mouseY));
Albert Astals Cid's avatar
Albert Astals Cid committed
123
    bool annotationAdded = partDocument(part)->page(0)->annotations().size() == annotationCount + 1;
Simone Gaiarin's avatar
Simone Gaiarin committed
124
125
126
127
128
129
130
131
    return annotationAdded;
}

void AnnotationToolBarTest::testAnnotationToolBar()
{
    // Using tabs we test that the annotation toolbar works on each Okular::Part
    Okular::Settings::self()->setShellOpenFileInTabs(true);

Albert Astals Cid's avatar
Albert Astals Cid committed
132
    const QStringList paths = {QStringLiteral(KDESRCDIR "data/file1.pdf"), QStringLiteral(KDESRCDIR "data/file2.pdf")};
Simone Gaiarin's avatar
Simone Gaiarin committed
133
134
135
136
137
138
139
140
141
142
    QString serializedOptions = ShellUtils::serializeOptions(false, false, false, false, false, QString(), QString());

    Okular::Status status = Okular::main(paths, serializedOptions);
    QCOMPARE(status, Okular::Success);
    Shell *s = findShell();
    QVERIFY(s);
    QVERIFY(QTest::qWaitForWindowExposed(s));

    QFETCH(int, tabIndex);
    s->m_tabWidget->tabBar()->setCurrentIndex(tabIndex);
Albert Astals Cid's avatar
Albert Astals Cid committed
143
    Okular::Part *part = dynamic_cast<Okular::Part *>(s->m_tabs[tabIndex].part);
Simone Gaiarin's avatar
Simone Gaiarin committed
144
145
    QVERIFY(part);

Albert Astals Cid's avatar
Albert Astals Cid committed
146
    QToolBar *annToolBar = s->findChild<QToolBar *>(QStringLiteral("annotationToolBar"));
Simone Gaiarin's avatar
Simone Gaiarin committed
147
148
149
    QVERIFY(annToolBar);

    // Check config action default enabled states
150
    KSelectAction *aQuickTools = qobject_cast<KSelectAction *>(part->actionCollection()->action(QStringLiteral("annotation_favorites")));
Simone Gaiarin's avatar
Simone Gaiarin committed
151
152
153
154
155
156
157
158
    QAction *aAddToQuickTools = part->actionCollection()->action(QStringLiteral("annotation_bookmark"));
    QAction *aAdvancedSettings = part->actionCollection()->action(QStringLiteral("annotation_settings_advanced"));
    QAction *aContinuousMode = part->actionCollection()->action(QStringLiteral("annotation_settings_pin"));
    QVERIFY(aQuickTools->isEnabled());
    QVERIFY(!aAddToQuickTools->isEnabled());
    QVERIFY(!aAdvancedSettings->isEnabled());
    QVERIFY(aContinuousMode->isEnabled());

159
160
    // Ensure that the 'Quick Annotations' action is correctly populated
    // (at least the 'Configure Annotations...' action must be present)
161
    QVERIFY(!aQuickTools->actions().isEmpty());
162

Simone Gaiarin's avatar
Simone Gaiarin committed
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
    // Test annotation toolbar visibility triggers
    QAction *toggleAnnotationToolBar = part->actionCollection()->action(QStringLiteral("mouse_toggle_annotate"));
    QAction *aHideToolBar = part->actionCollection()->action(QStringLiteral("hide_annotation_toolbar"));
    QVERIFY(toggleAnnotationToolBar);
    QVERIFY(aHideToolBar);
    toggleAnnotationToolBar->setChecked(false);
    QTRY_VERIFY(!annToolBar->isVisible());
    toggleAnnotationToolBar->trigger();
    QTRY_VERIFY2(annToolBar->isVisible(), "Annotation action failed to show.");
    toggleAnnotationToolBar->trigger();
    QTRY_VERIFY2(!annToolBar->isVisible(), "Annotation action failed to hide.");

    toggleAnnotationToolBar->setChecked(true);
    QTRY_VERIFY(annToolBar->isVisible());
    aHideToolBar->trigger();
    QTRY_VERIFY2(!annToolBar->isVisible(), "Hide toolbar action failed to hide.");

    toggleAnnotationToolBar->setChecked(false);
    QTRY_VERIFY(!annToolBar->isVisible());
182
    QTest::keyClick(part->widget(), Qt::Key_1, Qt::AltModifier);
Simone Gaiarin's avatar
Simone Gaiarin committed
183
184
185
    QTRY_VERIFY2(annToolBar->isVisible(), "ToolBar not shown when triggering annotation using shortcut.");
    toggleAnnotationToolBar->setChecked(false);
    QTRY_VERIFY(!annToolBar->isVisible());
186
    QTest::keyClick(part->widget(), Qt::Key_3);
Simone Gaiarin's avatar
Simone Gaiarin committed
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
    QTRY_VERIFY2(annToolBar->isVisible(), "ToolBar not shown when triggering quick annotation using shortcut.");

    // Click an annotation action to enable it
    QAction *aPopupNote = part->actionCollection()->action(QStringLiteral("annotation_popup_note"));
    QVERIFY(aPopupNote);
    aPopupNote->trigger();
    int mouseX = 350;
    int mouseY = 100;
    QTRY_COMPARE(Okular::Settings::mouseMode(), static_cast<int>(Okular::Settings::EnumMouseMode::Browse));
    QCOMPARE(simulateAddPopupAnnotation(part, mouseX, mouseY), true);

    // Click again the same annotation action to disable it
    aPopupNote->trigger();
    mouseY = 150;
    QTRY_COMPARE(Okular::Settings::mouseMode(), static_cast<int>(Okular::Settings::EnumMouseMode::Browse));
    QCOMPARE(simulateAddPopupAnnotation(part, mouseX, mouseY), false);

    // Trigger the action using a shortcut
205
    QTest::keyClick(part->widget(), Qt::Key_7, Qt::AltModifier);
Simone Gaiarin's avatar
Simone Gaiarin committed
206
207
208
209
210
211
212
213
214
215
216
    mouseY = 200;
    QTRY_COMPARE(Okular::Settings::mouseMode(), static_cast<int>(Okular::Settings::EnumMouseMode::Browse));
    QCOMPARE(simulateAddPopupAnnotation(part, mouseX, mouseY), true);

    // Click Esc to disable all annotations
    QTest::keyClick(pageView(part), Qt::Key_Escape);
    mouseY = 250;
    QTRY_COMPARE(Okular::Settings::mouseMode(), static_cast<int>(Okular::Settings::EnumMouseMode::Browse));
    QCOMPARE(simulateAddPopupAnnotation(part, mouseX, mouseY), false);

    // Trigger the action using a quick annotation shortcut
217
    QTest::keyClick(part->widget(), Qt::Key_6);
Simone Gaiarin's avatar
Simone Gaiarin committed
218
219
220
221
222
223
224
225
226
227
    QTRY_COMPARE(Okular::Settings::mouseMode(), static_cast<int>(Okular::Settings::EnumMouseMode::Browse));
    QCOMPARE(simulateAddPopupAnnotation(part, mouseX, mouseY), true);

    // Test pin/continuous mode action
    QVERIFY(aContinuousMode->isEnabled());
    QCOMPARE(simulateAddPopupAnnotation(part, mouseX, mouseY), true);
    QCOMPARE(simulateAddPopupAnnotation(part, mouseX, mouseY), true);
    aContinuousMode->trigger();
    QCOMPARE(simulateAddPopupAnnotation(part, mouseX, mouseY), true);
    QCOMPARE(simulateAddPopupAnnotation(part, mouseX, mouseY), false);
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243

    // Test adding a tool to the quick tool list using the bookmark action
    QScopedPointer<TestingUtils::CloseDialogHelper> closeDialogHelper;
    closeDialogHelper.reset(new TestingUtils::CloseDialogHelper(QDialogButtonBox::Ok));
    QAction *aEllipse = part->actionCollection()->action(QStringLiteral("annotation_ellipse"));
    aEllipse->trigger();
    QVERIFY(aEllipse->isChecked());
    int quickActionCount = aQuickTools->actions().size();
    aAddToQuickTools->trigger();
    QCOMPARE(aQuickTools->actions().size(), quickActionCount + 1);
    // Test that triggering a Quick Annotation action checks the corresponding built-in annotation action
    aQuickTools->actions().at(5)->trigger();
    QVERIFY(aPopupNote->isChecked());
    // Test again for tool just added to the quick tools using the bookmark button
    aQuickTools->actions().at(6)->trigger();
    QVERIFY(aEllipse->isChecked());
Simone Gaiarin's avatar
Simone Gaiarin committed
244
245
246
247
248
249
250
251
252
253
254
255
256
}

void AnnotationToolBarTest::testAnnotationToolBar_data()
{
    QTest::addColumn<int>("tabIndex");
    QTest::addRow("first tab") << 0;
    QTest::addRow("second tab") << 1;
}

void AnnotationToolBarTest::testAnnotationToolBarActionsEnabledState()
{
    QFETCH(QString, document);

Albert Astals Cid's avatar
Albert Astals Cid committed
257
    const QStringList paths = {document};
Simone Gaiarin's avatar
Simone Gaiarin committed
258
259
260
261
262
263
264
265
    QString serializedOptions = ShellUtils::serializeOptions(false, false, false, false, false, QString(), QString());

    Okular::Status status = Okular::main(paths, serializedOptions);
    QCOMPARE(status, Okular::Success);
    Shell *s = findShell();
    QVERIFY(s);
    QVERIFY(QTest::qWaitForWindowExposed(s));

Albert Astals Cid's avatar
Albert Astals Cid committed
266
    Okular::Part *part = s->findChild<Okular::Part *>();
Simone Gaiarin's avatar
Simone Gaiarin committed
267
268
269
    QVERIFY(part);

    KActionCollection *ac = part->actionCollection();
270
    QAction *aQuickTools = ac->action(QStringLiteral("annotation_favorites"));
Simone Gaiarin's avatar
Simone Gaiarin committed
271
272
273
274
275
276
277
278
279
280
281
    QAction *aHighlighter = ac->action(QStringLiteral("annotation_highlighter"));
    QAction *aUnderline = ac->action(QStringLiteral("annotation_underline"));
    QAction *aSquiggle = ac->action(QStringLiteral("annotation_squiggle"));
    QAction *aStrikeout = ac->action(QStringLiteral("annotation_strike_out"));
    QAction *aTypewriter = ac->action(QStringLiteral("annotation_typewriter"));
    QAction *aInlineNote = ac->action(QStringLiteral("annotation_inline_note"));
    QAction *aPopupNote = ac->action(QStringLiteral("annotation_popup_note"));
    QAction *aFreehandLine = ac->action(QStringLiteral("annotation_freehand_line"));
    QAction *aGeomShapes = ac->action(QStringLiteral("annotation_geometrical_shape"));
    QAction *aStamp = ac->action(QStringLiteral("annotation_stamp"));

282
    QFETCH(bool, aQuickToolsEnabled);
Simone Gaiarin's avatar
Simone Gaiarin committed
283
284
285
286
287
288
289
290
291
292
293
    QFETCH(bool, aHighlighterEnabled);
    QFETCH(bool, aUnderlineEnabled);
    QFETCH(bool, aSquiggleEnabled);
    QFETCH(bool, aStrikeoutEnabled);
    QFETCH(bool, aTypewriterEnabled);
    QFETCH(bool, aInlineNoteEnabled);
    QFETCH(bool, aPopupNoteEnabled);
    QFETCH(bool, aFreehandLineEnabled);
    QFETCH(bool, aGeomShapesEnabled);
    QFETCH(bool, aStampEnabled);

294
    QCOMPARE(aQuickTools->isEnabled(), aQuickToolsEnabled);
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
    QCOMPARE(aHighlighter->isEnabled(), aHighlighterEnabled);
    QCOMPARE(aUnderline->isEnabled(), aUnderlineEnabled);
    QCOMPARE(aSquiggle->isEnabled(), aSquiggleEnabled);
    QCOMPARE(aStrikeout->isEnabled(), aStrikeoutEnabled);
    QCOMPARE(aTypewriter->isEnabled(), aTypewriterEnabled);
    QCOMPARE(aInlineNote->isEnabled(), aInlineNoteEnabled);
    QCOMPARE(aPopupNote->isEnabled(), aPopupNoteEnabled);
    QCOMPARE(aFreehandLine->isEnabled(), aFreehandLineEnabled);
    QCOMPARE(aGeomShapes->isEnabled(), aGeomShapesEnabled);
    QCOMPARE(aStamp->isEnabled(), aStampEnabled);

    // trigger a reparsing of the tools to ensure that the enabled/disabled state is not changed (bug: 424296)
    QAction *aMouseSelect = ac->action(QStringLiteral("mouse_select"));
    QAction *aMouseNormal = ac->action(QStringLiteral("mouse_drag"));
    aMouseSelect->trigger();
    aMouseNormal->trigger();

    QCOMPARE(aQuickTools->isEnabled(), aQuickToolsEnabled);
Simone Gaiarin's avatar
Simone Gaiarin committed
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
    QCOMPARE(aHighlighter->isEnabled(), aHighlighterEnabled);
    QCOMPARE(aUnderline->isEnabled(), aUnderlineEnabled);
    QCOMPARE(aSquiggle->isEnabled(), aSquiggleEnabled);
    QCOMPARE(aStrikeout->isEnabled(), aStrikeoutEnabled);
    QCOMPARE(aTypewriter->isEnabled(), aTypewriterEnabled);
    QCOMPARE(aInlineNote->isEnabled(), aInlineNoteEnabled);
    QCOMPARE(aPopupNote->isEnabled(), aPopupNoteEnabled);
    QCOMPARE(aFreehandLine->isEnabled(), aFreehandLineEnabled);
    QCOMPARE(aGeomShapes->isEnabled(), aGeomShapesEnabled);
    QCOMPARE(aStamp->isEnabled(), aStampEnabled);
}

void AnnotationToolBarTest::testAnnotationToolBarActionsEnabledState_data()
{
    QTest::addColumn<QString>("document");
328
    QTest::addColumn<bool>("aQuickToolsEnabled");
Simone Gaiarin's avatar
Simone Gaiarin committed
329
330
331
332
333
334
335
336
337
338
339
    QTest::addColumn<bool>("aHighlighterEnabled");
    QTest::addColumn<bool>("aUnderlineEnabled");
    QTest::addColumn<bool>("aSquiggleEnabled");
    QTest::addColumn<bool>("aStrikeoutEnabled");
    QTest::addColumn<bool>("aTypewriterEnabled");
    QTest::addColumn<bool>("aInlineNoteEnabled");
    QTest::addColumn<bool>("aPopupNoteEnabled");
    QTest::addColumn<bool>("aFreehandLineEnabled");
    QTest::addColumn<bool>("aGeomShapesEnabled");
    QTest::addColumn<bool>("aStampEnabled");

340
341
342
    QTest::addRow("pdf") << QStringLiteral(KDESRCDIR "data/file1.pdf") << true << true << true << true << true << true << true << true << true << true << true;
    QTest::addRow("protected-pdf") << QStringLiteral(KDESRCDIR "data/protected.pdf") << false << false << false << false << false << false << false << false << false << false << false;
    QTest::addRow("image") << QStringLiteral(KDESRCDIR "data/potato.jpg") << true << false << false << false << false << true << true << true << true << true << true;
Simone Gaiarin's avatar
Simone Gaiarin committed
343
344
345
346
}

void AnnotationToolBarTest::testAnnotationToolBarConfigActionsEnabledState()
{
Albert Astals Cid's avatar
Albert Astals Cid committed
347
    const QStringList paths = {QStringLiteral(KDESRCDIR "data/file1.pdf")};
Simone Gaiarin's avatar
Simone Gaiarin committed
348
349
350
351
352
353
354
355
    QString serializedOptions = ShellUtils::serializeOptions(false, false, false, false, false, QString(), QString());

    Okular::Status status = Okular::main(paths, serializedOptions);
    QCOMPARE(status, Okular::Success);
    Shell *s = findShell();
    QVERIFY(s);
    QVERIFY(QTest::qWaitForWindowExposed(s));

Albert Astals Cid's avatar
Albert Astals Cid committed
356
    Okular::Part *part = s->findChild<Okular::Part *>();
Simone Gaiarin's avatar
Simone Gaiarin committed
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
    QVERIFY(part);

    KActionCollection *ac = part->actionCollection();
    QAction *aWidth = ac->action(QStringLiteral("annotation_settings_width"));
    QAction *aColor = ac->action(QStringLiteral("annotation_settings_color"));
    QAction *aInnerColor = ac->action(QStringLiteral("annotation_settings_inner_color"));
    QAction *aOpacity = ac->action(QStringLiteral("annotation_settings_opacity"));
    QAction *aFont = ac->action(QStringLiteral("annotation_settings_font"));

    QFETCH(QString, annotationActionName);
    QFETCH(bool, widthEnabled);
    QFETCH(bool, colorEnabled);
    QFETCH(bool, innerColorEnabled);
    QFETCH(bool, opacityEnabled);
    QFETCH(bool, fontEnabled);

    QAction *annotationAction = ac->action(annotationActionName);
    annotationAction->trigger();

    QCOMPARE(aWidth->isEnabled(), widthEnabled);
    QCOMPARE(aColor->isEnabled(), colorEnabled);
    QCOMPARE(aInnerColor->isEnabled(), innerColorEnabled);
    QCOMPARE(aOpacity->isEnabled(), opacityEnabled);
    QCOMPARE(aFont->isEnabled(), fontEnabled);
}

void AnnotationToolBarTest::testAnnotationToolBarConfigActionsEnabledState_data()
{
    QTest::addColumn<QString>("annotationActionName");
    QTest::addColumn<bool>("widthEnabled");
    QTest::addColumn<bool>("colorEnabled");
    QTest::addColumn<bool>("innerColorEnabled");
    QTest::addColumn<bool>("opacityEnabled");
    QTest::addColumn<bool>("fontEnabled");

Albert Astals Cid's avatar
Albert Astals Cid committed
392
393
394
395
396
397
398
399
400
401
    QTest::addRow("annotation_highlighter") << QStringLiteral("annotation_highlighter") << false << true << false << true << false;
    QTest::addRow("annotation_underline") << QStringLiteral("annotation_underline") << false << true << false << true << false;
    QTest::addRow("annotation_squiggle") << QStringLiteral("annotation_squiggle") << false << true << false << true << false;
    QTest::addRow("annotation_strike_out") << QStringLiteral("annotation_strike_out") << false << true << false << true << false;
    QTest::addRow("annotation_typewriter") << QStringLiteral("annotation_typewriter") << false << true << false << true << true;
    QTest::addRow("annotation_inline_note") << QStringLiteral("annotation_inline_note") << false << true << false << true << true;
    QTest::addRow("annotation_popup_note") << QStringLiteral("annotation_popup_note") << false << true << false << true << false;
    QTest::addRow("annotation_freehand_line") << QStringLiteral("annotation_freehand_line") << true << true << false << true << false;
    QTest::addRow("annotation_line") << QStringLiteral("annotation_straight_line") << true << true << false << true << false;
    QTest::addRow("annotation_rectangle") << QStringLiteral("annotation_rectangle") << true << true << true << true << false;
Simone Gaiarin's avatar
Simone Gaiarin committed
402
403
}

Albert Astals Cid's avatar
Albert Astals Cid committed
404
QTEST_MAIN(AnnotationToolBarTest)
Simone Gaiarin's avatar
Simone Gaiarin committed
405
#include "annotationtoolbartest.moc"