mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Add regression test for issue #56.
This commit is contained in:
parent
97b488b2ba
commit
6ee781a608
@ -155,6 +155,9 @@ add_unit_test(NAME testwildcardmatcher SOURCES TestWildcardMatcher.cpp MOCS Test
|
|||||||
add_unit_test(NAME testautotype SOURCES TestAutoType.cpp MOCS TestAutoType.h
|
add_unit_test(NAME testautotype SOURCES TestAutoType.cpp MOCS TestAutoType.h
|
||||||
LIBS ${TEST_LIBRARIES})
|
LIBS ${TEST_LIBRARIES})
|
||||||
|
|
||||||
|
add_unit_test(NAME testentry SOURCES TestEntry.cpp MOCS TestEntry.h
|
||||||
|
LIBS ${TEST_LIBRARIES})
|
||||||
|
|
||||||
if(WITH_GUI_TESTS)
|
if(WITH_GUI_TESTS)
|
||||||
add_subdirectory(gui)
|
add_subdirectory(gui)
|
||||||
endif(WITH_GUI_TESTS)
|
endif(WITH_GUI_TESTS)
|
||||||
|
39
tests/TestEntry.cpp
Normal file
39
tests/TestEntry.cpp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2013 Felix Geyer <debfx@fobos.de>
|
||||||
|
*
|
||||||
|
* 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 or (at your option)
|
||||||
|
* version 3 of the License.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "TestEntry.h"
|
||||||
|
|
||||||
|
#include <QtTest/QTest>
|
||||||
|
|
||||||
|
#include "tests.h"
|
||||||
|
#include "core/Entry.h"
|
||||||
|
|
||||||
|
void TestEntry::testHistoryItemDeletion()
|
||||||
|
{
|
||||||
|
Entry* entry = new Entry();
|
||||||
|
Entry* historyEntry = new Entry();
|
||||||
|
|
||||||
|
entry->addHistoryItem(historyEntry);
|
||||||
|
QCOMPARE(entry->historyItems().size(), 1);
|
||||||
|
|
||||||
|
QList<Entry*> historyEntriesToRemove;
|
||||||
|
historyEntriesToRemove.append(historyEntry);
|
||||||
|
entry->removeHistoryItems(historyEntriesToRemove);
|
||||||
|
QCOMPARE(entry->historyItems().size(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
QTEST_GUILESS_MAIN(TestEntry)
|
34
tests/TestEntry.h
Normal file
34
tests/TestEntry.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2013 Felix Geyer <debfx@fobos.de>
|
||||||
|
*
|
||||||
|
* 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 or (at your option)
|
||||||
|
* version 3 of the License.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef KEEPASSX_TESTENTRY_H
|
||||||
|
#define KEEPASSX_TESTENTRY_H
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
|
class Entry;
|
||||||
|
|
||||||
|
class TestEntry : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void testHistoryItemDeletion();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // KEEPASSX_TESTENTRY_H
|
Loading…
Reference in New Issue
Block a user