From 0f11ba0ee6d20a9c6429d34a326c8632667702a3 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Wed, 22 Jan 2014 19:41:20 -0500 Subject: [PATCH] gui: Create a new test for the Collection tab This is a bit cleaner that having one giant switch-statement based test. Signed-off-by: Anna Schumaker --- gui/ocarina6.glade | 4 ++- gui/wires.cpp | 1 - tests/gui/gui.cpp | 64 ++++++++++++++++++++++++++++++++++------------ 3 files changed, 50 insertions(+), 19 deletions(-) diff --git a/gui/ocarina6.glade b/gui/ocarina6.glade index 6ec8750c..59d91e66 100644 --- a/gui/ocarina6.glade +++ b/gui/ocarina6.glade @@ -54,6 +54,8 @@ False select-folder False + False + False True @@ -294,7 +296,7 @@ True False - gtk-harddisk + system-file-manager 1 diff --git a/gui/wires.cpp b/gui/wires.cpp index 54a6d7ed..bdc47181 100644 --- a/gui/wires.cpp +++ b/gui/wires.cpp @@ -63,7 +63,6 @@ static void on_collection_row_activated(const Gtk::TreePath &path, Gtk::TreeModel::Row row = *(list->get_iter(path)); Glib::ustring dir = row[collection_cols.c_col_path]; - chooser->set_current_folder(dir); } diff --git a/tests/gui/gui.cpp b/tests/gui/gui.cpp index dbc672ef..05d5dc85 100644 --- a/tests/gui/gui.cpp +++ b/tests/gui/gui.cpp @@ -5,6 +5,7 @@ #include #include #include +#include static unsigned int i; @@ -40,6 +41,47 @@ void activate_treeview_row(const std::string &tv_name, const std::string &path) treeview->row_activated(Gtk::TreePath(path), col); } +void change_page(unsigned int page) +{ + Gtk::Notebook *notebook; + get_builder()->get_widget("o_notebook", notebook); + notebook->set_current_page(page); +} + +/* Library tab tests */ +bool test_1() +{ + switch (i) { + case 0: + print("Test 1\n"); + change_page(0); + break; + case 1: + case 5: + on_collection_toggled("0"); + break; + case 2: + case 6: + on_collection_toggled("1"); + break; + case 3: + case 7: + on_collection_toggled("2"); + break; + case 4: + case 8: + on_collection_toggled("3"); + break; + case 9: + break; + default: + end_test(); + return false; + }; + i++; + return true; +} + /* Collection manager tests */ bool test_0() { @@ -103,25 +145,9 @@ bool test_0() click_button("o_collection_import"); break; case 19: - case 23: - on_collection_toggled("0"); - break; - case 20: - case 24: - on_collection_toggled("1"); - break; - case 25: - case 21: - on_collection_toggled("2"); - break; - case 26: - case 22: - on_collection_toggled("3"); - break; - case 27: break; default: - end_test(); + schedule_test(test_1); return false; } i++; @@ -132,6 +158,10 @@ bool test_0() int main(int argc, char **argv) { Gtk::Main ocarina(argc, argv); + + library::init(); + library::reset(); + Gtk::Window *window = ocarina_init(); schedule_test(test_0);