gui/collection: Add new library paths through the GUI
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
f34e2cb57b
commit
08910bef7c
|
@ -30,7 +30,6 @@
|
|||
<property name="xpad">5</property>
|
||||
<property name="ypad">5</property>
|
||||
<property name="icon_name">dialog-ok</property>
|
||||
<property name="icon_size">3</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image12">
|
||||
<property name="visible">True</property>
|
||||
|
@ -906,7 +905,7 @@
|
|||
<property name="halign">center</property>
|
||||
<property name="layout_style">start</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button1">
|
||||
<object class="GtkButton" id="o_collection_add">
|
||||
<property name="label" translatable="yes">Add Selected Path</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
|
@ -1115,6 +1114,7 @@ Manager</property>
|
|||
<object class="GtkBox" id="box12">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkProgressBar" id="o_idle_progress">
|
||||
<property name="can_focus">False</property>
|
||||
|
@ -1122,35 +1122,12 @@ Manager</property>
|
|||
<property name="valign">center</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label11">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="o_sorting_indicator">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="o_queue_time">
|
||||
<property name="visible">True</property>
|
||||
|
@ -1161,6 +1138,20 @@ Manager</property>
|
|||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="o_sorting_indicator">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
|
|
@ -2,26 +2,48 @@
|
|||
* Copyright 2015 (c) Anna Schumaker.
|
||||
*/
|
||||
#define TEST_NEED_AUDIO
|
||||
#include <core/core.h>
|
||||
#include <gui/builder.h>
|
||||
#include <gui/collection.h>
|
||||
#include <tests/gui.h>
|
||||
#include <tests/test.h>
|
||||
|
||||
GMainLoop *main_loop;
|
||||
struct core_init_data init_data;
|
||||
|
||||
static int test_on_idle(gpointer data)
|
||||
{
|
||||
g_main_loop_quit(main_loop);
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
static void test_collection_sidebar()
|
||||
{
|
||||
GtkTreeSelection *selection;
|
||||
GtkProgressBar *progress;
|
||||
GtkFileChooser *chooser;
|
||||
GtkTreeIter iter, child;
|
||||
GtkNotebook *notebook;
|
||||
GtkTreeView *treeview;
|
||||
GtkTreeModel *model;
|
||||
GtkTreePath *path;
|
||||
GtkWindow *window;
|
||||
|
||||
struct library *library;
|
||||
int argc = 0;
|
||||
|
||||
gtk_init(&argc, NULL);
|
||||
gui_builder_init("share/ocarina/ocarina6.glade");
|
||||
core_init(&argc, NULL, &init_data);
|
||||
gui_collection_init();
|
||||
|
||||
main_loop = g_main_loop_new(NULL, FALSE);
|
||||
window = GTK_WINDOW(gui_builder_widget("o_window"));
|
||||
g_idle_add(test_on_idle, window);
|
||||
|
||||
notebook = GTK_NOTEBOOK(gui_builder_widget("o_notebook"));
|
||||
progress = GTK_PROGRESS_BAR(gui_builder_widget("o_idle_progress"));
|
||||
chooser = GTK_FILE_CHOOSER(gui_builder_widget("colmgr_chooser"));
|
||||
treeview = GTK_TREE_VIEW(gui_builder_widget("o_collection_view"));
|
||||
selection = gtk_tree_view_get_selection(treeview);
|
||||
model = GTK_TREE_MODEL(gui_builder_object("o_collection_store"));
|
||||
|
@ -40,6 +62,23 @@ static void test_collection_sidebar()
|
|||
test_equal(gtk_notebook_get_current_page(notebook),
|
||||
gtk_notebook_get_n_pages(notebook) - 1);
|
||||
|
||||
gtk_file_chooser_set_filename(chooser, "tests/Music/Hyrule Symphony");
|
||||
g_main_loop_run(main_loop);
|
||||
gtk_button_clicked(GTK_BUTTON(gui_builder_widget("o_collection_add")));
|
||||
|
||||
gtk_tree_model_get_iter_first(model, &iter);
|
||||
test_equal(gtk_tree_model_iter_n_children(model, &iter), 2);
|
||||
gtk_tree_model_iter_nth_child(model, &child, &iter, 0);
|
||||
gtk_tree_model_get(model, &child, 5, &library, -1);
|
||||
test_equal((void *)library, (void *)library_get(0));
|
||||
|
||||
/* Run two idle events to scan the added path. */
|
||||
test_equal(gtk_widget_is_visible(GTK_WIDGET(progress)), true);
|
||||
g_main_loop_run(main_loop);
|
||||
test_equal((float)gtk_progress_bar_get_fraction(progress), (float)0.5);
|
||||
g_main_loop_run(main_loop);
|
||||
test_equal(gtk_widget_is_visible(GTK_WIDGET(progress)), false);
|
||||
|
||||
gui_builder_deinit();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue