1BClipboard(const char *name, bool transient = false) 2case 1: name is NULL => 3 (Note: R5 segfaults) 4 create system clipboard 5 Name() returns "system" 6case 2: name points to valid string => 7 Name() returns a copy of name 8 9status_t Clear(void) 10case 1: BClipboard not locked => 11 return B_ERROR (R5 segfaults) 12case 2: BClipboard is locked => 13 return B_OK 14 Data() returns an empty message 15 16status_t Commit(void) 17case 1: BClipboard not locked => 18 return B_ERROR (R5 segfaults) 19case 2: BClipboard is locked => 20 return B_OK 21 data is uploaded to system 22 23status_t Revert(void) 24case 1: BClipboard not locked => 25 return B_ERROR (R5 segfaults) 26case 2: BClipboard is locked => 27 return B_OK 28 message returned by Data() is reset to value acquired on Lock() 29 30BMessage *Data(void) const 31case 1: BClipboard not locked => 32 return NULL (R5 segfaults) 33case 2: BClipboard is locked => 34 returns a BMessage containing correct data 35 36BMessenger DataSource(void) const 37case 1: clipboard has never been written => 38 returns an invalid BMessenger 39case 2: BClipboard has never been locked => 40 returns an invalid BMessenger 41case 3: BClipboard has been locked at some point => 42 returns BMessenger that wrote the data acquired in the last Lock() 43 44uint32 LocalCount(void) const 45case 1: BClipboard has not been read or written => 46 return 0 47case 2: BClipboard "A" writes once, no other BClipboards write => 48 return 1 49case 3: BClipboard "B" writes once, BClipboard "A" reads => 50 return 1 for both BClipboards 51case 4: BClipboard "B" writes, BClipboard "A" reads, BClipboard "B" writes => 52 return 1 for BClipboard "A", return 2 for BClipboard "B" 53case 5: BClipboard "A" writes, BClipboard "B" writes => 54 return 1 for BClipboard "A", return 2 for BClipboard "B" 55case 6: BClipboard "A" writes to system clipboard "A", BClipboard "B" reads from system clipboard "B" => 56 return 1 for BClipboard "A", return 0 for BClipboard "B" 57 58uint32 SystemCount(void) const 59case 1: clipboard has never been written by any BClipboards => 60 return 0 61case 2: BClipboard "A" writes, BClipboard "B" neither reads nor writes => 62 return 1 for both 63case 3: BClipboard "A" writes to system clipboard "A", BClipboard "B" is attached to system clipboard "B" => 64 return 1 for BClipboard "A", return 0 for BClipboard "B" 65 66bool Lock(void) 67case 1: BClipboard is not locked by any threads => 68 return true 69 data is downloaded from system 70case 2: BClipboard is deleted while Lock() is blocked => 71 return false 72 73bool IsLocked(void) 74case 1: BClipboard is not locked => 75 return false 76case 2: BClipboard is locked => 77 return true 78 79void Lock(void) 80case 1: BClipboard is locked => 81 unlocks clipboard (IsLocked returns false) 82 83const char *Name(void) const 84covered by constructor test cases 85 86status_t StartWatching(BMessenger target) 87case 1: => 88 return B_OK, target is notified when clipboard is written 89 90status_t StopWatching(BMessenger target) 91case 1: target is watching the BClipboard => 92 return B_OK 93case 2: target is not watching the BClipboard => 94 return B_BAD_VALUE 95