Skip to content

Commit

Permalink
Introducing Arora
Browse files Browse the repository at this point in the history
  • Loading branch information
icefox committed Apr 11, 2008
0 parents commit ecb2641
Show file tree
Hide file tree
Showing 114 changed files with 75,056 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
arora
Arora.app
Makefile
.DS_Store
.ui
.moc
.obj
.rcc

autotests/addbookmarkdialog/addbookmarkdialog
autotests/autosaver/autosaver
autotests/downloadmanager/downloadmanager
autotests/history/history
autotests/historyfiltermodel/historyfiltermodel
autotests/searchlineedit/searchlineedit
autotests/tabwidget/tabwidget
autotests/webactionmapper/webactionmapper
autotests/xbel/xbel

manualtests/bookmarks/bookmarks
manualtests/downloadmanager/downloadmanager
manualtests/history/history
manualtests/searchlineedit/searchlineedit
manualtests/urllineedit/urllineedit

18 changes: 18 additions & 0 deletions GPLHEADER
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright 2008 Name <[email protected]>
*
* 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.
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
351 changes: 351 additions & 0 deletions LICENSE.GPL2

Large diffs are not rendered by default.

688 changes: 688 additions & 0 deletions LICENSE.GPL3

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Arora web browser

http://arora.googlecode.com/

Arora is a cross platform web browser built using Qt and WebKit.

Arora is a fork of the Demo Browser that was shipped with Qt 4.4.0. All new development is no longer going into the demo browser, but here. Some have critizized the demo browser for being to large already and should have been kicked out earlier.
8 changes: 8 additions & 0 deletions arora.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
QMAKEVERSION = $$[QMAKE_VERSION]
ISQT4 = $$find(QMAKEVERSION, ^[2-9])
isEmpty( ISQT4 ) {
error("Use the qmake include with Qt4.4 or greater, on Debian that is qmake-qt4");
}

TEMPLATE = subdirs
SUBDIRS = src/
9 changes: 9 additions & 0 deletions autotests/addbookmarkdialog/addbookmarkdialog.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .

include(../autotests.pri)

# Input
SOURCES += tst_addbookmarkdialog.cpp
144 changes: 144 additions & 0 deletions autotests/addbookmarkdialog/tst_addbookmarkdialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
/*
* Copyright 2008 Benjamin C. Meyer <[email protected]>
*
* 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.
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/

#include <QtTest/QtTest>

#include <bookmarks.h>
#include <xbel.h>
#include <browserapplication.h>

class tst_AddBookmarkDialog : public QObject
{
Q_OBJECT

public slots:
void initTestCase();
void cleanupTestCase();
void init();
void cleanup();

private slots:
void addbookmarkdialog_data();
void addbookmarkdialog();
};

// Subclass that exposes the protected functions.
class SubAddBookmarkDialog : public AddBookmarkDialog
{

public:
SubAddBookmarkDialog(const QString &url, const QString &title, QWidget *parent, BookmarksManager *manager)
: AddBookmarkDialog(url, title, parent, manager){}

};

// This will be called before the first test function is executed.
// It is only called once.
void tst_AddBookmarkDialog::initTestCase()
{
QCoreApplication::setApplicationName("addbookmarkdialogtest");
}

// This will be called after the last test function is executed.
// It is only called once.
void tst_AddBookmarkDialog::cleanupTestCase()
{
}

// This will be called before each test function is executed.
void tst_AddBookmarkDialog::init()
{
BookmarksManager *manager = BrowserApplication::bookmarksManager();
BookmarkNode *root = manager->bookmarks();
QList<BookmarkNode*> nodes = root->children();
BookmarkNode *menu = nodes[0];
BookmarkNode *toolbar = nodes[1];
while (!menu->children().isEmpty())
manager->removeBookmark(menu->children().first());
while (!toolbar->children().isEmpty())
manager->removeBookmark(toolbar->children().first());
}

// This will be called after every test function.
void tst_AddBookmarkDialog::cleanup()
{
}

Q_DECLARE_METATYPE(QDialogButtonBox::StandardButton)
void tst_AddBookmarkDialog::addbookmarkdialog_data()
{
QTest::addColumn<QString>("url");
QTest::addColumn<QString>("title");
QTest::addColumn<QDialogButtonBox::StandardButton>("button");
QTest::addColumn<int>("menuCount");
QTest::addColumn<int>("toolbarCount");
QTest::addColumn<int>("select");

// select invalid, menu, toolbar, submenu
QTest::newRow("cancel") << "url" << "title" << QDialogButtonBox::Cancel << 0 << 0 << -1;
QTest::newRow("ok default") << "url" << "title" << QDialogButtonBox::Ok << 1 << 0 << -1;
QTest::newRow("ok toolbar") << "url" << "title" << QDialogButtonBox::Ok << 0 << 1 << 0;
QTest::newRow("ok menu") << "url" << "title" << QDialogButtonBox::Ok << 1 << 0 << 1;
}

void tst_AddBookmarkDialog::addbookmarkdialog()
{
QFETCH(QString, url);
QFETCH(QString, title);
QFETCH(QDialogButtonBox::StandardButton, button);
QFETCH(int, menuCount);
QFETCH(int, toolbarCount);
QFETCH(int, select);

BookmarksManager *manager = BrowserApplication::bookmarksManager();
qRegisterMetaType<BookmarkNode *>("BookmarkNode *");
QSignalSpy spy(manager, SIGNAL(entryAdded(BookmarkNode *)));
BookmarkNode *menu = manager->menu();
BookmarkNode *toolbar = manager->toolbar();
QCOMPARE(menu->children().count(), 0);
QCOMPARE(toolbar->children().count(), 0);

SubAddBookmarkDialog dialog(url, title, 0, manager);
QComboBox *combobox = dialog.findChild<QComboBox*>();
QVERIFY(combobox);
if (select != -1) {
combobox->setCurrentIndex(select);
combobox->view()->setCurrentIndex(combobox->model()->index(select, 0));
}
QDialogButtonBox *buttonBox = dialog.findChild<QDialogButtonBox*>();
QVERIFY(buttonBox);
QPushButton *pushButton = buttonBox->button(button);
pushButton->click();

QCOMPARE(spy.count(), menuCount + toolbarCount);

QCOMPARE(menu->children().count(), menuCount);
QCOMPARE(toolbar->children().count(), toolbarCount);
BookmarkNode *node = 0;
if (menuCount == 1) node = menu->children()[0];
if (toolbarCount == 1) node = toolbar->children()[0];
if (node) {
QCOMPARE(node->title, title);
QCOMPARE(node->url, url);
}
}

QTEST_MAIN(tst_AddBookmarkDialog)
#include "tst_addbookmarkdialog.moc"

10 changes: 10 additions & 0 deletions autotests/autosaver/autosaver.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .

include(../autotests.pri)

# Input
SOURCES = tst_autosaver.cpp autosaver.cpp
HEADERS = autosaver.h
148 changes: 148 additions & 0 deletions autotests/autosaver/tst_autosaver.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
/*
* Copyright 2008 Benjamin C. Meyer <[email protected]>
*
* 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.
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/

#include <QtTest/QtTest>
#include <autosaver.h>

class tst_AutoSaver : public QObject
{
Q_OBJECT

public slots:
void initTestCase();
void cleanupTestCase();
void init();
void cleanup();

private slots:
void AutoSaver_data();
void AutoSaver();
void changeOccurred_data();
void changeOccurred();

void deleted();
};

// Subclass that exposes the protected functions.
class SubAutoSaver : public AutoSaver
{
public:
SubAutoSaver(QObject *parent = 0) : AutoSaver(parent){}
void call_timerEvent(QTimerEvent* event)
{ return SubAutoSaver::timerEvent(event); }
};

class TestClass : public QObject
{
Q_OBJECT

signals:
void saveCalled();

public:
TestClass(QObject *parent = 0) : QObject(parent), AutoSaver(new SubAutoSaver(this))
{
}

~TestClass()
{
AutoSaver->saveIfNeccessary();
}

SubAutoSaver *AutoSaver;

public slots:
void save() {
emit saveCalled();
}
};

// This will be called before the first test function is executed.
// It is only called once.
void tst_AutoSaver::initTestCase()
{
}

// This will be called after the last test function is executed.
// It is only called once.
void tst_AutoSaver::cleanupTestCase()
{
}

// This will be called before each test function is executed.
void tst_AutoSaver::init()
{
}

// This will be called after every test function.
void tst_AutoSaver::cleanup()
{
}

void tst_AutoSaver::AutoSaver_data()
{
}

void tst_AutoSaver::AutoSaver()
{
SubAutoSaver save(this);
save.changeOccurred();
}

typedef QList<int> IntList;
Q_DECLARE_METATYPE(IntList)
void tst_AutoSaver::changeOccurred_data()
{
QTest::addColumn<IntList>("changed");
QTest::addColumn<int>("saved");
QTest::newRow("no changes") << (QList<int>()) << 0;
QTest::newRow("1 changes") << (QList<int>() << 0) << 1;
QTest::newRow("3 changes in a row") << (QList<int>() << 0 << 0 << 0) << 1;
QTest::newRow("2 changes 4 secs, 1 change") << (QList<int>() << 0 << 0 << 4000) << 2;
QTest::newRow("0, 1.5s, 2s, 12s(force save), 100m, 100m") << (QList<int>() << 0 << 1500 << 2000 << 12000 << 100 << 100) << 2;
}

// public void changeOccurred()
void tst_AutoSaver::changeOccurred()
{
QFETCH(IntList, changed);
QFETCH(int, saved);

TestClass *test = new TestClass;
QSignalSpy spy(test, SIGNAL(saveCalled()));
for (int i = 0; i < changed.count(); ++i) {
QTest::qWait(changed.at(i));
test->AutoSaver->changeOccurred();
}
delete test;
QCOMPARE(spy.count(), saved);
}

void tst_AutoSaver::deleted()
{
TestClass *test = new TestClass;
QSignalSpy spy(test, SIGNAL(saveCalled()));
test->AutoSaver->changeOccurred();
delete test;
QCOMPARE(spy.count(), 1);
}

QTEST_MAIN(tst_AutoSaver)
#include "tst_autosaver.moc"

19 changes: 19 additions & 0 deletions autotests/autotests.pri
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
win32: CONFIG += console
mac:CONFIG -= app_bundle

CONFIG += qtestlib

include($$PWD/../src/src.pri)
include($$PWD/modeltest/modeltest.pri)

HEADERS += qtest_arora.h

INCLUDEPATH += $$PWD
DEPENDPATH += $$PWD

RCC_DIR = $$PWD/.rcc
UI_DIR = $$PWD/.ui
MOC_DIR = $$PWD/.moc
OBJECTS_DIR = $$PWD/.obj


Loading

0 comments on commit ecb2641

Please sign in to comment.