From edb644baef2c39b248d67362c29ec887db20ddf5 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Sun, 22 Jul 2012 00:00:44 +0200 Subject: [PATCH] Add TestGui::testCloneEntry(). --- tests/gui/TestGui.cpp | 20 ++++++++++++++++++++ tests/gui/TestGui.h | 1 + 2 files changed, 21 insertions(+) diff --git a/tests/gui/TestGui.cpp b/tests/gui/TestGui.cpp index 3f1b08bb..1e514f1e 100644 --- a/tests/gui/TestGui.cpp +++ b/tests/gui/TestGui.cpp @@ -221,6 +221,26 @@ void TestGui::testSearch() QCOMPARE(entryView->model()->rowCount(), 1); } +void TestGui::testCloneEntry() +{ + EntryView* entryView = m_dbWidget->entryView(); + + QCOMPARE(entryView->model()->rowCount(), 1); + + QModelIndex item = entryView->model()->index(0, 1); + Entry* entryOrg = entryView->entryFromIndex(item); + QRect itemRect = entryView->visualRect(item); + QTest::mouseClick(entryView->viewport(), Qt::LeftButton, Qt::NoModifier, itemRect.center()); + QTest::qWait(20); + + triggerAction("actionEntryClone"); + + QCOMPARE(entryView->model()->rowCount(), 2); + Entry* entryClone = entryView->entryFromIndex(entryView->model()->index(1, 1)); + QVERIFY(entryOrg->uuid() != entryClone->uuid()); + QCOMPARE(entryClone->title(), entryOrg->title()); +} + void TestGui::testDragAndDropEntry() { EntryView* entryView = m_dbWidget->entryView(); diff --git a/tests/gui/TestGui.h b/tests/gui/TestGui.h index 5553fb41..69fa30d0 100644 --- a/tests/gui/TestGui.h +++ b/tests/gui/TestGui.h @@ -38,6 +38,7 @@ private Q_SLOTS: void testEditEntry(); void testAddEntry(); void testSearch(); + void testCloneEntry(); void testDragAndDropEntry(); void testDragAndDropGroup(); void testSaveAs();