Changeset View
Changeset View
Standalone View
Standalone View
src/autotests/TerminalInterfaceTest.cpp
Show All 13 Lines | 1 | /* | |||
---|---|---|---|---|---|
14 | You should have received a copy of the GNU General Public License | 14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program; if not, write to the Free Software | 15 | along with this program; if not, write to the Free Software | ||
16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
17 | 02110-1301 USA. | 17 | 02110-1301 USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | // Own | 20 | // Own | ||
21 | #include "TerminalInterfaceTest.h" | 21 | #include "TerminalInterfaceTest.h" | ||
22 | #include "../Profile.h" | ||||
23 | #include "../ProfileManager.h" | ||||
24 | #include "config-konsole.h" | ||||
22 | 25 | | |||
23 | // Qt | 26 | // Qt | ||
24 | #include <QDir> | 27 | #include <QDir> | ||
25 | #include <QSignalSpy> | 28 | #include <QSignalSpy> | ||
26 | #include <QTimer> | 29 | #include <QTimer> | ||
27 | 30 | | |||
28 | // KDE | 31 | // KDE | ||
29 | #include <KService> | 32 | #include <KService> | ||
▲ Show 20 Lines • Show All 133 Lines • ▼ Show 20 Line(s) | 81 | { | |||
163 | 166 | | |||
164 | // Now we check to make sure we don't have any signals already | 167 | // Now we check to make sure we don't have any signals already | ||
165 | QCOMPARE(destroyedSpy.count(), 0); | 168 | QCOMPARE(destroyedSpy.count(), 0); | ||
166 | 169 | | |||
167 | delete _terminalPart; | 170 | delete _terminalPart; | ||
168 | QCOMPARE(destroyedSpy.count(), 1); | 171 | QCOMPARE(destroyedSpy.count(), 1); | ||
169 | } | 172 | } | ||
170 | 173 | | |||
174 | void TerminalInterfaceTest::testTerminalInterfaceV2() | ||||
175 | { | ||||
176 | #ifdef USE_TERMINALINTERFACEV2 | ||||
177 | Profile::Ptr testProfile(new Profile); | ||||
178 | testProfile->useFallback(); | ||||
179 | ProfileManager::instance()->addProfile(testProfile); | ||||
180 | | ||||
181 | _terminalPart = createPart(); | ||||
182 | if (_terminalPart == nullptr) { | ||||
183 | QSKIP("konsolepart not found.", SkipSingle); | ||||
184 | } | ||||
185 | | ||||
186 | TerminalInterfaceV2 *terminal = qobject_cast<TerminalInterfaceV2*>(_terminalPart); | ||||
187 | | ||||
188 | QVERIFY(terminal); | ||||
189 | QVERIFY(terminal->setCurrentProfile(testProfile->name())); | ||||
190 | QCOMPARE(terminal->currentProfileName(), testProfile->name()); | ||||
191 | | ||||
192 | QCOMPARE(terminal->profileProperty(QStringLiteral("Path")), testProfile->path()); | ||||
193 | QCOMPARE(terminal->profileProperty(QStringLiteral("SilenceSeconds")), testProfile->silenceSeconds()); | ||||
194 | QCOMPARE(terminal->profileProperty(QStringLiteral("Icon")), testProfile->icon()); | ||||
195 | QCOMPARE(terminal->profileProperty(QStringLiteral("ShowTerminalSizeHint")), testProfile->showTerminalSizeHint()); | ||||
196 | QCOMPARE(terminal->profileProperty(QStringLiteral("Environment")), testProfile->environment()); | ||||
197 | QCOMPARE(terminal->profileProperty(QStringLiteral("BellMode")), testProfile->property<QVariant>(Profile::Property::BellMode)); | ||||
198 | #else | ||||
199 | QSKIP("TerminalInterfaceV2 not enabled", SkipSingle); | ||||
200 | #endif | ||||
201 | } | ||||
202 | | ||||
171 | KParts::Part *TerminalInterfaceTest::createPart() | 203 | KParts::Part *TerminalInterfaceTest::createPart() | ||
172 | { | 204 | { | ||
173 | KService::Ptr service = KService::serviceByDesktopName(QStringLiteral("konsolepart")); | 205 | KService::Ptr service = KService::serviceByDesktopName(QStringLiteral("konsolepart")); | ||
174 | if (!service) { // not found | 206 | if (!service) { // not found | ||
175 | return nullptr; | 207 | return nullptr; | ||
176 | } | 208 | } | ||
177 | KPluginFactory *factory = KPluginLoader(service->library()).factory(); | 209 | KPluginFactory *factory = KPluginLoader(service->library()).factory(); | ||
178 | if (factory == nullptr) { // not found | 210 | if (factory == nullptr) { // not found | ||
Show All 9 Lines |