aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-22 08:44:14 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-22 08:44:14 +0000
commita4326697a4f1158e8d20edf1b32421138c7966f8 (patch)
tree9056dfb9d7de7b8deb81102cad951d3c33d6e4a9
parent1aa9e2bfb063d848d8bd0a210515b7d4e9ad20ab (diff)
downloadpaludis-a4326697a4f1158e8d20edf1b32421138c7966f8.tar.gz
paludis-a4326697a4f1158e8d20edf1b32421138c7966f8.tar.xz
Add a simple menu to gtkpaludis. Start using dogtail for gtkpaludis tests.
-rw-r--r--src/gtkpaludis/Makefile.am9
-rw-r--r--src/gtkpaludis/main_window.cc14
-rw-r--r--src/gtkpaludis/menu.hh45
-rwxr-xr-xsrc/gtkpaludis/quit_TEST.py13
-rwxr-xr-xsrc/gtkpaludis/quit_TEST_cleanup.sh14
-rwxr-xr-xsrc/gtkpaludis/quit_TEST_setup.sh68
-rwxr-xr-xtest/run_test.sh1
7 files changed, 158 insertions, 6 deletions
diff --git a/src/gtkpaludis/Makefile.am b/src/gtkpaludis/Makefile.am
index 3540e3b..8c01240 100644
--- a/src/gtkpaludis/Makefile.am
+++ b/src/gtkpaludis/Makefile.am
@@ -22,6 +22,8 @@ TESTS_ENVIRONMENT = env \
PALUDIS_REPOSITORY_SO_DIR="`$(top_srcdir)/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories`" \
PALUDIS_HOME="$(srcdir)" \
SYSCONFDIR="$(sysconfdir)" \
+ GNOME_ACCESSIBILITY="1" \
+ GTK_MODULES="gail:atk-bridge" \
bash $(top_srcdir)/test/run_test.sh $(srcdir)/test_helper.bash
IF_GTK_TESTS = version_TEST help_TEST sets_list_TEST
@@ -34,6 +36,7 @@ common_sources = \
categories_list.cc categories_list.hh \
install.cc install.hh \
main_window.cc main_window.hh \
+ menu.cc menu.hh \
messages.cc messages.hh \
package_info.cc package_info.hh \
package_overview.cc package_overview.hh \
@@ -73,7 +76,9 @@ if ENABLE_GTK_TESTS
check_PROGRAMS = prod-x-server sets_list_TEST
check_SCRIPTS = \
- sets_list_TEST_setup.sh sets_list_TEST_cleanup.sh
+ sets_list_TEST_setup.sh sets_list_TEST_cleanup.sh \
+ quit_TEST.py quit_TEST_setup.sh quit_TEST_cleanup.sh
+
check_LIBRARIES = libtestcommon.a
libtestcommon_a_SOURCES = test_common.hh test_common.cc
@@ -88,7 +93,7 @@ sets_list_TEST_LDADD = \
prod_x_server_SOURCES = prod-x-server.cc
prod_x_server_LDADD = -lX11
-TESTS = version_TEST help_TEST sets_list_TEST
+TESTS = version_TEST help_TEST quit_TEST.py sets_list_TEST
endif
diff --git a/src/gtkpaludis/main_window.cc b/src/gtkpaludis/main_window.cc
index b89b678..ff29aa7 100644
--- a/src/gtkpaludis/main_window.cc
+++ b/src/gtkpaludis/main_window.cc
@@ -24,6 +24,7 @@
#include "messages.hh"
#include "tasks_page.hh"
#include "queue_page.hh"
+#include "menu.hh"
#include <paludis/util/log.hh>
@@ -51,6 +52,7 @@ namespace paludis
Gtk::Table main_table;
+ Menu menu;
Gtk::Notebook main_notebook;
TasksPage tasks_page;
PackagesPage packages_page;
@@ -69,7 +71,7 @@ namespace paludis
Implementation() :
lock_count(0),
- main_table(1, 2, false),
+ main_table(1, 3, false),
messages_page(1, 1, false)
{
}
@@ -83,7 +85,7 @@ MainWindow::MainWindow() :
set_border_width(2);
set_default_size(600, 400);
- _imp->main_notebook.set_border_width(5);
+// _imp->main_notebook.set_border_width(5);
_imp->main_notebook.signal_switch_page().connect(sigc::mem_fun(this,
&MainWindow::_main_notebook_page_switched));
@@ -95,9 +97,13 @@ MainWindow::MainWindow() :
_imp->messages_page_id = _imp->main_notebook.append_page(_imp->messages_page, "Messages");
add(_imp->main_table);
- _imp->main_table.attach(_imp->main_notebook, 0, 1, 0, 1);
+
+ _imp->main_table.attach(*_imp->menu.get_menu_widget(), 0, 1, 0, 1, Gtk::FILL, Gtk::AttachOptions(0));
+ _imp->menu.add_accel_group_to(this);
+
+ _imp->main_table.attach(_imp->main_notebook, 0, 1, 1, 2);
_imp->status_bar.set_has_resize_grip(true);
- _imp->main_table.attach(_imp->status_bar, 0, 1, 1, 2, Gtk::FILL, Gtk::AttachOptions(0));
+ _imp->main_table.attach(_imp->status_bar, 0, 1, 2, 3, Gtk::FILL, Gtk::AttachOptions(0));
_imp->messages_page.attach(_imp->messages, 0, 1, 0, 1);
diff --git a/src/gtkpaludis/menu.hh b/src/gtkpaludis/menu.hh
new file mode 100644
index 0000000..f0e4634
--- /dev/null
+++ b/src/gtkpaludis/menu.hh
@@ -0,0 +1,45 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis 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., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_SRC_GTKPALUDIS_MENU_HH
+#define PALUDIS_GUARD_SRC_GTKPALUDIS_MENU_HH 1
+
+#include <paludis/util/instantiation_policy.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <gtkmm/widget.h>
+#include <gtkmm/window.h>
+
+namespace gtkpaludis
+{
+ class Menu :
+ private paludis::PrivateImplementationPattern<Menu>
+ {
+ private:
+ void action_quit();
+
+ public:
+ Menu();
+ ~Menu();
+
+ Gtk::Widget * get_menu_widget();
+ void add_accel_group_to(Gtk::Window *);
+ };
+}
+
+#endif
diff --git a/src/gtkpaludis/quit_TEST.py b/src/gtkpaludis/quit_TEST.py
new file mode 100755
index 0000000..67081ca
--- /dev/null
+++ b/src/gtkpaludis/quit_TEST.py
@@ -0,0 +1,13 @@
+#!/usr/bin/env python
+
+import os
+import dogtail.procedural
+import dogtail.utils
+
+os.environ["PALUDIS_HOME"] = os.getcwd() + "/quit_TEST_dir/home"
+
+dogtail.utils.run('./gtkpaludis', appName = 'lt-gtkpaludis')
+dogtail.procedural.focus.application('lt-gtkpaludis')
+dogtail.procedural.click('Quit')
+
+
diff --git a/src/gtkpaludis/quit_TEST_cleanup.sh b/src/gtkpaludis/quit_TEST_cleanup.sh
new file mode 100755
index 0000000..253db39
--- /dev/null
+++ b/src/gtkpaludis/quit_TEST_cleanup.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d quit_TEST_dir ] ; then
+ rm -fr quit_TEST_dir
+else
+ true
+fi
+
+
+
+
+
+
diff --git a/src/gtkpaludis/quit_TEST_setup.sh b/src/gtkpaludis/quit_TEST_setup.sh
new file mode 100755
index 0000000..b0cf840
--- /dev/null
+++ b/src/gtkpaludis/quit_TEST_setup.sh
@@ -0,0 +1,68 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir quit_TEST_dir || exit 1
+cd quit_TEST_dir || exit 1
+
+mkdir -p home/.paludis/repositories
+
+cat <<END > home/.paludis/repositories/testrepo.conf
+location = `pwd`/testrepo
+format = portage
+cache = /var/empty
+profiles = \${location}/profiles/testprofile
+END
+
+cat <<END > home/.paludis/keywords.conf
+* test
+~foo/bar-1 ~test
+END
+
+cat <<END > home/.paludis/use.conf
+* enabled
+~foo/bar-1 sometimes_enabled
+END
+
+cat <<END > home/.paludis/licenses.conf
+* *
+END
+
+mkdir -p testrepo/{eclass,distfiles,profiles/testprofile,foo/bar/files} || exit 1
+cd testrepo || exit 1
+echo "testrepo" > profiles/repo_name || exit 1
+cat <<END > profiles/categories || exit 1
+foo
+END
+cat <<END > profiles/testprofile/make.defaults
+ARCH=test
+USERLAND=test
+KERNEL=test
+END
+cat <<END > profiles/profiles.desc
+test testprofile stable
+END
+
+cat <<"END" > foo/bar/bar-1.0.ebuild || exit 1
+DESCRIPTION="Test package"
+HOMEPAGE="http://paludis.berlios.de/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="test"
+END
+
+cat <<"END" > foo/bar/bar-2.0.ebuild || exit 1
+DESCRIPTION="Test package"
+HOMEPAGE="http://paludis.berlios.de/"
+SRC_URI=""
+SLOT="0"
+IUSE=""
+LICENSE="GPL-2"
+KEYWORDS="~test"
+END
+cd ..
+
+
+
+
diff --git a/test/run_test.sh b/test/run_test.sh
index c707978..6f1a68b 100755
--- a/test/run_test.sh
+++ b/test/run_test.sh
@@ -3,6 +3,7 @@
testname=${2:-${1}}
testname=${testname%.rb}
+testname=${testname%.py}
if test -f "$TEST_SCRIPT_DIR""${testname}"_"cleanup.sh" ; then
echo ">>> cleanup for test ${testname}"