The Winamp Remote Control suite
a remote control client and plugin for Winamp 2.x, 5.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
VCLTests.cpp
Go to the documentation of this file.
1 /*
2  * VCLTests.cpp
3  *
4  * Created on: 27 Jul 2013
5  * Author: Patrick
6  */
7 
8 #include "catch.hpp"
9 
10 #include <forms.hpp>
11 
12 #include "CursorGuard.h"
13 #include "ClientConfig.h"
14 
15 #include <sstream.h>
16 
17 namespace WinampRemote
18 {
19 namespace UnitTest
20 {
21 
22 TEST_CASE("UI/CursorGuard", "tests Cursor Guard class")
23 {
24  Controls::TCursor startCursor = Screen->Cursor;
25  {
27  CHECK(Screen->Cursor == crHourGlass);
28  }
29  CHECK(Screen->Cursor == startCursor);
30 
31  {
32  WinampRemote::Utils::CursorGuard ci(crAppStart);
33  CHECK(Screen->Cursor == crAppStart);
34  }
35  CHECK(Screen->Cursor == startCursor);
36 }
37 
38 TEST_CASE("Client/Config", "tests ClientConfig class")
39 {
40 
41  // create 2 instances
44 
45  // stream out the representations
46  std::ostringstream ostr, ostr_old, ostr_new;
47  ostr << config;
48  ostr_old << config_old;
49  // check the streams
50  CHECK(ostr.str() == ostr_old.str());
51 
52  //update a value
53  LONG bottom = config.PlaylistPos().Bottom;
54  config.PlaylistPos().Bottom++;
55  CHECK((bottom + 1) == config.PlaylistPos().Bottom);
56 
57  // check the stream changes
58  ostr_new << config;
59  CHECK(ostr.str() != ostr_new.str());
60 
61 
62 }
63 
64 } /* namespace UnitTest */
65 } /* namespace WinampRemote */