fix tricky regression noticed by Vyacheslav Tokarev on Google Reader.
[kdelibs.git] / khtml / tests / khtmlparttest.cpp
blob1cf6536ee7caf7d26690ab1de26dbe248a9f4d40
1 /* This file is part of the KDE project
3 * Copyright (C) 2007 Germain Garand <germain@ebooksfrance.org>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 #include <khtml_part.h>
22 #include <qtest_kde.h>
23 #include <khtmlview.h>
24 #include "khtmlparttest.h"
25 #include <csignal>
26 #include <cstdlib>
28 QTEST_KDEMAIN( KHTMLPartTest, GUI )
30 void __abort(int) {
31 std::signal(SIGABRT, SIG_DFL);
32 std::signal(SIGSEGV, SIG_DFL);
33 QVERIFY( false );
36 void KHTMLPartTest::initTestCase()
38 std::signal(SIGABRT, &__abort);
39 std::signal(SIGSEGV, &__abort);
42 class MyKHTMLPart : public KHTMLPart
44 public:
45 MyKHTMLPart() : KHTMLPart( new KHTMLView(this, 0) ) {}
48 void KHTMLPartTest::testConstructKHTMLViewFromInitList()
50 // test that KHTMLView can be built from a derived KHTMLPart's initialization list
51 KHTMLPart* aPart = new MyKHTMLPart();
52 QVERIFY(true);
53 QVERIFY(aPart->view()->part() == aPart);
54 delete aPart;
57 void KHTMLPartTest::testConstructKHTMLViewBeforePart()
59 // test that a KHTMLView can be constructed before a KHTMLPart
60 KHTMLView* view = new KHTMLView(0, 0);
61 KHTMLPart* part = new KHTMLPart(view);
62 QVERIFY(true);
63 QVERIFY(view->part() == part);
64 delete part;