TEST(ClipboardTests, unmarshall_withTextAndHtml_getHtmlIsValid) { Clipboard clipboard; String data; data += (char)0; data += (char)0; data += (char)0; data += (char)2; // 2 formats added data += (char)0; data += (char)0; data += (char)0; data += (char)IClipboard::kText; data += (char)0; data += (char)0; data += (char)0; data += (char)14; data += "synergy rocks!"; data += (char)0; data += (char)0; data += (char)0; data += (char)IClipboard::kHTML; data += (char)0; data += (char)0; data += (char)0; data += (char)10; data += "html sucks"; clipboard.unmarshall(data, 0); clipboard.open(0); String actual = clipboard.get(IClipboard::kHTML); EXPECT_EQ("html sucks", actual); }
TEST(ClipboardTests, unmarshall_withTextSize285_getTextIsValid) { Clipboard clipboard; // 285 chars String text; text.append("Synergy is Free and Open Source Software that lets you "); text.append("easily share your mouse and keyboard between multiple "); text.append("computers, where each computer has it's own display. No "); text.append("special hardware is required, all you need is a local area "); text.append("network. Synergy is supported on Windows, Mac OS X and Linux."); String data; data += (char)0; data += (char)0; data += (char)0; data += (char)1; // 1 format added data += (char)0; data += (char)0; data += (char)0; data += (char)IClipboard::kText; data += (char)0; // 285 >> 24 = 285 / (256^3) = 0 data += (char)0; // 285 >> 16 = 285 / (256^2) = 0 data += (char)1; // 285 >> 8 = 285 / (256^1) = 1(.11328125) data += (char)29; // 285 - 256 = 29 data += text; clipboard.unmarshall(data, 0); clipboard.open(0); String actual = clipboard.get(IClipboard::kText); EXPECT_EQ(text, actual); }
TEST(ClipboardTests, get_withNoFormats_returnsEmpty) { Clipboard clipboard; clipboard.open(0); String actual = clipboard.get(IClipboard::kText); EXPECT_EQ("", actual); }
TEST(ClipboardTests, add_newValue_valueWasStored) { Clipboard clipboard; clipboard.open(0); clipboard.add(IClipboard::kText, "synergy rocks!"); String actual = clipboard.get(IClipboard::kText); EXPECT_EQ("synergy rocks!", actual); }
TEST(ClipboardTests, get_withFormatAdded_returnsExpected) { Clipboard clipboard; clipboard.open(0); clipboard.add(IClipboard::kText, "synergy rocks!"); String actual = clipboard.get(IClipboard::kText); EXPECT_EQ("synergy rocks!", actual); }
TEST(ClipboardTests, add_replaceValue_valueWasReplaced) { Clipboard clipboard; clipboard.open(0); clipboard.add(IClipboard::kText, "synergy rocks!"); clipboard.add(IClipboard::kText, "maxivista sucks"); // haha, just kidding. String actual = clipboard.get(IClipboard::kText); EXPECT_EQ("maxivista sucks", actual); }