xref: /haiku/src/tests/kits/app/bclipboard/BClipboardTester.cpp (revision e81a954787e50e56a7f06f72705b7859b6ab06d1)
1 //------------------------------------------------------------------------------
2 //	BClipboardTester.cpp
3 //
4 //------------------------------------------------------------------------------
5 
6 // Standard Includes -----------------------------------------------------------
7 #include <string.h>
8 
9 // System Includes -------------------------------------------------------------
10 #include <Application.h>
11 #include <Clipboard.h>
12 
13 #define CHK	CPPUNIT_ASSERT
14 
15 // Project Includes ------------------------------------------------------------
16 
17 // Local Includes --------------------------------------------------------------
18 #include "BClipboardTester.h"
19 
20 // Local Defines ---------------------------------------------------------------
21 
22 // Globals ---------------------------------------------------------------------
23 
24 //------------------------------------------------------------------------------
25 
26 /*
27 	BClipboard(const char *name, bool transient = false)
28 	@case 1
29 	@results		clipboard defaults to system clipboard
30  */
31 void BClipboardTester::BClipboard1()
32 {
33   BApplication app("application/x-vnd.clipboardtest");
34 #ifdef TEST_R5
35   CHK(false);
36 #endif
37   BClipboard clip(NULL);
38   CHK(strcmp(clip.Name(),"system") == 0);
39 }
40 
41 /*
42 	BClipboard(const char *name, bool transient = false)
43 	@case 2
44 	@results		return string from Name() should match *name
45  */
46 void BClipboardTester::BClipboard2()
47 {
48   BApplication app("application/x-vnd.clipboardtest");
49   char name[18] = "BClipboard Case 2";
50   BClipboard clip(name);
51 
52   CHK(strcmp(clip.Name(),name) == 0);
53 }
54 
55 Test* BClipboardTester::Suite()
56 {
57 	TestSuite* SuiteOfTests = new TestSuite;
58 
59 	ADD_TEST4(BClipboard, SuiteOfTests, BClipboardTester, BClipboard1);
60 	ADD_TEST4(BClipboard, SuiteOfTests, BClipboardTester, BClipboard2);
61 
62 	return SuiteOfTests;
63 }
64 
65 
66 
67