コード例 #1
0
ファイル: wordEncoderTest.cpp プロジェクト: 0xbda2d2f8/vmime
	void testIsEncodingNeeded_specialChars()
	{
		VASSERT_TRUE("rfc2047", vmime::wordEncoder::isEncodingNeeded
			(vmime::generationContext::getDefaultContext(),
			 "foo bar =? foo bar", vmime::charset("us-ascii")));

		VASSERT_TRUE("new line 1", vmime::wordEncoder::isEncodingNeeded
			(vmime::generationContext::getDefaultContext(),
			 "foo bar \n foo bar", vmime::charset("us-ascii")));

		VASSERT_TRUE("new line 2", vmime::wordEncoder::isEncodingNeeded
			(vmime::generationContext::getDefaultContext(),
			 "foo bar \r foo bar", vmime::charset("us-ascii")));
	}
コード例 #2
0
	void testIsEncoded()
	{
		vmime::fileContentHandler cth(testFile, vmime::encoding("base64"));

		VASSERT_TRUE("encoded", cth.isEncoded());
		VASSERT_EQ("encoding", "base64", cth.getEncoding().generate());
	}
コード例 #3
0
	VMIME_TEST_LIST_END


	void testIsEmpty()
	{
		vmime::streamContentHandler cth;

		VASSERT_TRUE("empty", cth.isEmpty());
	}
コード例 #4
0
ファイル: POP3StoreTest.cpp プロジェクト: 0xd34df00d/vmime
	VMIME_TEST_LIST_END


	void testCreateFromURL()
	{
		vmime::shared_ptr <vmime::net::session> sess = vmime::net::session::create();

		// POP3
		vmime::utility::url url("pop3://pop3.vmime.org");
		vmime::shared_ptr <vmime::net::store> store = sess->getStore(url);

		VASSERT_TRUE("pop3", typeid(*store) == typeid(vmime::net::pop3::POP3Store));

		// POP3S
		vmime::utility::url url2("pop3s://pop3s.vmime.org");
		vmime::shared_ptr <vmime::net::store> store2 = sess->getStore(url2);

		VASSERT_TRUE("pop3s", typeid(*store2) == typeid(vmime::net::pop3::POP3SStore));
	}
コード例 #5
0
ファイル: wordEncoderTest.cpp プロジェクト: 0xbda2d2f8/vmime
	void testIsEncodingNeeded_ascii()
	{
		vmime::generationContext ctx(vmime::generationContext::getDefaultContext());
		ctx.setInternationalizedEmailSupport(false);

		VASSERT_FALSE("ascii", vmime::wordEncoder::isEncodingNeeded
			(ctx, "ASCII-only buffer", vmime::charset("utf-8")));

		VASSERT_TRUE("non-ascii", vmime::wordEncoder::isEncodingNeeded
			(ctx, "Buffer with some UTF-8 '\xc3\xa0'", vmime::charset("utf-8")));
	}
コード例 #6
0
	void testParseNoEndDelimiter()
	{
		vmime::addressList addrs;
		addrs.parse("group: aaa <*****@*****.**>, bbb <*****@*****.**>");

		VASSERT_EQ("count", 1, addrs.getAddressCount());
		VASSERT_TRUE("is group", addrs.getAddressAt(0)->isGroup());

		vmime::ref <vmime::mailboxGroup> mgrp =
			addrs.getAddressAt(0).dynamicCast <vmime::mailboxGroup>();

		VASSERT_EQ("name", "group", mgrp->getName().getWholeBuffer());
		VASSERT_EQ("count", 2, mgrp->getMailboxCount());

		VASSERT_EQ("mbox1.email", "*****@*****.**", mgrp->getMailboxAt(0)->getEmail());
		VASSERT_EQ("mbox1.name", "aaa", mgrp->getMailboxAt(0)->getName());

		VASSERT_EQ("mbox2.email", "*****@*****.**", mgrp->getMailboxAt(1)->getEmail());
		VASSERT_EQ("mbox2.name", "bbb", mgrp->getMailboxAt(1)->getName());
	}
コード例 #7
0
	void testIsEncoded()
	{
		vmime::string data("Test Data");
		vmime::shared_ptr <vmime::utility::inputStream> stream =
			vmime::make_shared <vmime::utility::inputStreamStringAdapter>(data);

		vmime::streamContentHandler cth(stream, data.length());

		VASSERT_FALSE("encoded", cth.isEncoded());
		VASSERT_EQ("encoding", vmime::contentHandler::NO_ENCODING, cth.getEncoding());


		vmime::string data2("Zm9vEjRWYmFy=");
		vmime::shared_ptr <vmime::utility::inputStream> stream2 =
			vmime::make_shared <vmime::utility::inputStreamStringAdapter>(data2);

		vmime::streamContentHandler cth2(stream2, data2.length(), vmime::encoding("base64"));

		VASSERT_TRUE("encoded", cth2.isEncoded());
		VASSERT_EQ("encoding", "base64", cth2.getEncoding().generate());
	}
コード例 #8
0
	void testIsEmpty()
	{
		vmime::fileContentHandler cth;

		VASSERT_TRUE("empty", cth.isEmpty());
	}