|
@@ -1,5 +1,7 @@
|
|
|
using System;
|
|
using System;
|
|
|
using Gtk;
|
|
using Gtk;
|
|
|
|
|
+using Newtonsoft.Json;
|
|
|
|
|
+using crown_tests.tests;
|
|
|
|
|
|
|
|
public partial class MainWindow : Gtk.Window
|
|
public partial class MainWindow : Gtk.Window
|
|
|
{
|
|
{
|
|
@@ -9,7 +11,6 @@ public partial class MainWindow : Gtk.Window
|
|
|
//gxml.Autoconnect(this);
|
|
//gxml.Autoconnect(this);
|
|
|
Title = "Test Browser";
|
|
Title = "Test Browser";
|
|
|
SetSizeRequest(500, 300);
|
|
SetSizeRequest(500, 300);
|
|
|
-
|
|
|
|
|
|
|
|
|
|
// Create a column for the artist name
|
|
// Create a column for the artist name
|
|
|
Gtk.TreeViewColumn artistColumn = new Gtk.TreeViewColumn();
|
|
Gtk.TreeViewColumn artistColumn = new Gtk.TreeViewColumn();
|
|
@@ -25,17 +26,7 @@ public partial class MainWindow : Gtk.Window
|
|
|
treeview1.AppendColumn(artistColumn);
|
|
treeview1.AppendColumn(artistColumn);
|
|
|
treeview1.AppendColumn(songColumn);
|
|
treeview1.AppendColumn(songColumn);
|
|
|
|
|
|
|
|
- Gtk.TreeStore testsStore = new Gtk.TreeStore(typeof(string), typeof(string));
|
|
|
|
|
-
|
|
|
|
|
- Gtk.TreeIter iter = testsStore.AppendValues("FileSystem");
|
|
|
|
|
- testsStore.AppendValues(iter, "Test 1", "Test file existence");
|
|
|
|
|
- testsStore.AppendValues(iter, "Test 2", "Create empty file");
|
|
|
|
|
-
|
|
|
|
|
- iter = testsStore.AppendValues("Json");
|
|
|
|
|
- testsStore.AppendValues(iter, "Test 3", "Loading a simple file");
|
|
|
|
|
- testsStore.AppendValues(iter, "Test 4", "Saving a simple file");
|
|
|
|
|
-
|
|
|
|
|
- treeview1.Model = testsStore;
|
|
|
|
|
|
|
+ treeview1.Model = LoadData();
|
|
|
|
|
|
|
|
Gtk.CellRendererText testNameCell = new Gtk.CellRendererText();
|
|
Gtk.CellRendererText testNameCell = new Gtk.CellRendererText();
|
|
|
artistColumn.PackStart(testNameCell, true);
|
|
artistColumn.PackStart(testNameCell, true);
|
|
@@ -46,6 +37,24 @@ public partial class MainWindow : Gtk.Window
|
|
|
// Tell the Cell Renderers which items in the model to display
|
|
// Tell the Cell Renderers which items in the model to display
|
|
|
artistColumn.AddAttribute(testNameCell, "text", 0);
|
|
artistColumn.AddAttribute(testNameCell, "text", 0);
|
|
|
songColumn.AddAttribute(testDescriptionCell, "text", 1);
|
|
songColumn.AddAttribute(testDescriptionCell, "text", 1);
|
|
|
|
|
+
|
|
|
|
|
+ LoadData();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private Gtk.TreeStore LoadData()
|
|
|
|
|
+ {
|
|
|
|
|
+ var container = JsonConvert.DeserializeObject<TestContainer>(System.IO.File.ReadAllText("tests.json"));
|
|
|
|
|
+
|
|
|
|
|
+ Gtk.TreeStore testsStore = new Gtk.TreeStore(typeof(string), typeof(string));
|
|
|
|
|
+ foreach (var category in container.Categories)
|
|
|
|
|
+ {
|
|
|
|
|
+ var iter = testsStore.AppendValues(category.Name);
|
|
|
|
|
+ foreach (var test in category.Tests)
|
|
|
|
|
+ {
|
|
|
|
|
+ testsStore.AppendValues(iter, test.Name, test.Description);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return testsStore;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
protected override bool OnDeleteEvent(Gdk.Event evnt)
|
|
protected override bool OnDeleteEvent(Gdk.Event evnt)
|