2
* Copyright 2010 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 3, as published
6
* by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranties of
10
* MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11
* PURPOSE. See the GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* version 3 along with this program. If not, see
15
* <http://www.gnu.org/licenses/>
17
* Authored by: Gordon Allott <gord.allott@canonical.com>
22
#include "Nux/VLayout.h"
23
#include "Nux/Button.h"
24
#include "Nux/TextureArea.h"
25
#include "Nux/WindowThread.h"
26
#include "NuxGraphics/GraphicsEngine.h"
29
#include "PreviewBasicButton.h"
30
#include "PreviewMusic.h"
31
#include "DashStyle.h"
39
static void InitWindowThread (nux::NThread* thread, void* InitData);
47
TestRunner::TestRunner ()
51
TestRunner::~TestRunner ()
55
void TestRunner::Init ()
57
unity::dash::Preview::Properties properties;
58
unity::dash::AlbumPreview* album_preview = new unity::dash::AlbumPreview (properties);
60
album_preview->name = "Fron: Legacy OST";
61
album_preview->artist = "Daft Funk";
62
album_preview->year = "2011";
63
album_preview->length = (92 * 60) + 32;
64
album_preview->genres.push_back("Funk");
65
album_preview->genres.push_back("Frank");
67
album_preview->tracks.push_back(unity::dash::AlbumPreview::Track(0, "Underture", 90, "foo/play", "foo/pause"));
68
album_preview->tracks.push_back(unity::dash::AlbumPreview::Track(1, "The Grind", 90, "foo/play", "foo/pause"));
69
album_preview->tracks.push_back(unity::dash::AlbumPreview::Track(2, "Daughter of Flan", 90, "foo/play", "foo/pause"));
70
album_preview->tracks.push_back(unity::dash::AlbumPreview::Track(3, "Who?", 90, "foo/play", "foo/pause"));
71
album_preview->tracks.push_back(unity::dash::AlbumPreview::Track(4, "Peace", 90, "foo/play", "foo/pause"));
72
album_preview->tracks.push_back(unity::dash::AlbumPreview::Track(5, "Daggerfall", 90, "foo/play", "foo/pause"));
74
album_preview->album_cover = "firefox.png";
75
album_preview->primary_action_name = "Play Album";
76
album_preview->primary_action_icon_hint = "none";
77
album_preview->primary_action_uri = "play/album";
79
unity::dash::Preview::Ptr preview = unity::dash::Preview::Ptr(album_preview);
80
unity::PreviewMusicAlbum* preview_view = new unity::PreviewMusicAlbum (preview, NUX_TRACKER_LOCATION);
81
preview_view->UriActivated.connect ([] (std::string uri) { g_debug ("Uri Activated: %s", uri.c_str()); });
82
layout = new nux::VLayout(NUX_TRACKER_LOCATION);
84
layout->AddView (preview_view, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
86
nux::GetGraphicsThread()->SetLayout (layout);
89
void TestRunner::InitWindowThread(nux::NThread* thread, void* InitData)
91
TestRunner *self = (TestRunner *) InitData;
96
ControlThread (nux::NThread* thread,
99
// sleep for 3 seconds
100
nux::SleepForMilliseconds (3000);
101
printf ("ControlThread successfully started\n");
105
int main(int argc, char **argv)
107
nux::SystemThread* st = NULL;
108
nux::WindowThread* wt = NULL;
110
// no real tests right now, just make sure we don't get any criticals and such
111
// waiting on nice perceptual diff support before we can build real tests
115
g_thread_init (NULL);
116
gtk_init (&argc, &argv);
118
nux::NuxInitialize(0);
120
// The instances for the pseudo-singletons.
121
unity::DashStyle dash_style;
123
TestRunner *test_runner = new TestRunner ();
124
wt = nux::CreateGUIThread(TEXT("Unity Places Tile Test"),
127
&TestRunner::InitWindowThread,
130
st = nux::CreateSystemThread (NULL, ControlThread, wt);