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 <schumaker.anna@gmail.com>
This commit is contained in:
Anna Schumaker 2014-01-22 19:41:20 -05:00 committed by Anna Schumaker
parent 62a1b4dcb6
commit 0f11ba0ee6
3 changed files with 50 additions and 19 deletions

View File

@ -54,6 +54,8 @@
<property name="can_focus">False</property>
<property name="action">select-folder</property>
<property name="create_folders">False</property>
<property name="preview_widget_active">False</property>
<property name="use_preview_label">False</property>
</object>
<packing>
<property name="expand">True</property>
@ -294,7 +296,7 @@
<object class="GtkImage" id="image8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-harddisk</property>
<property name="icon_name">system-file-manager</property>
<property name="icon_size">1</property>
</object>
<packing>

View File

@ -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);
}

View File

@ -5,6 +5,7 @@
#include <idle.h>
#include <ocarina.h>
#include <print.h>
#include <stdlib.h>
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);