aboutsummaryrefslogtreecommitdiffstats
path: root/tests/utility/encoder/qpEncoderTest.cpp
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2014-01-14 07:18:24 +0000
committerVincent Richard <[email protected]>2014-01-14 07:18:24 +0000
commitfe43da096f4bd4449535735dfc9e9d1f81f2d854 (patch)
tree5322d81eddeda1222666d9cfafff0a0b0b8bc5ea /tests/utility/encoder/qpEncoderTest.cpp
parentFixed mix-up between resize and reserve. (diff)
downloadvmime-fe43da096f4bd4449535735dfc9e9d1f81f2d854.tar.gz
vmime-fe43da096f4bd4449535735dfc9e9d1f81f2d854.zip
Reset line length after encoding a hard line break in QP encoding.
Diffstat (limited to 'tests/utility/encoder/qpEncoderTest.cpp')
-rw-r--r--tests/utility/encoder/qpEncoderTest.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/utility/encoder/qpEncoderTest.cpp b/tests/utility/encoder/qpEncoderTest.cpp
index 50183488..e7d1bcd2 100644
--- a/tests/utility/encoder/qpEncoderTest.cpp
+++ b/tests/utility/encoder/qpEncoderTest.cpp
@@ -31,6 +31,8 @@ VMIME_TEST_SUITE_BEGIN(qpEncoderTest)
VMIME_TEST_LIST_BEGIN
VMIME_TEST(testQuotedPrintable)
VMIME_TEST(testQuotedPrintable_SoftLineBreaks)
+ VMIME_TEST(testQuotedPrintable_HardLineBreakEncode)
+ VMIME_TEST(testQuotedPrintable_HardLineBreakDecode)
VMIME_TEST(testQuotedPrintable_CRLF)
VMIME_TEST(testQuotedPrintable_RFC2047)
VMIME_TEST_LIST_END
@@ -157,6 +159,42 @@ VMIME_TEST_SUITE_BEGIN(qpEncoderTest)
"to come to the aid of their country.", 15));
}
+ void testQuotedPrintable_HardLineBreakEncode()
+ {
+ const std::string data =
+ "If you believe that truth=beauty,"
+ " then surely mathematics\r\nis the most"
+ " beautiful branch of philosophy.";
+
+ const std::string expected =
+ "If you believe that truth=3Dbeauty=\r\n"
+ ", then surely mathematics\r\n"
+ "is the most beautiful branch of ph=\r\n"
+ "ilosophy.";
+
+ vmime::propertySet encProps;
+ encProps["text"] = true;
+
+ VASSERT_EQ("1", expected, encode("quoted-printable", data, 35, encProps));
+ }
+
+ void testQuotedPrintable_HardLineBreakDecode()
+ {
+ const std::string expected =
+ "If you believe that truth=beauty,"
+ " then surely mathematics\r\nis the most"
+ " beautiful branch of philosophy.";
+
+ const std::string data =
+ "If you believe that truth=3Dbeauty=\r\n"
+ ", then surely mathematics\r\n"
+ "is the most beautiful branch of ph=\r\n"
+ "ilosophy.";
+
+ VASSERT_EQ("1", expected, decode("quoted-printable", data, 35));
+ }
+
+
/** In text mode, ensure line breaks in QP-encoded text are represented
* by a CRLF sequence, as per RFC-2047/6.7(4). */
void testQuotedPrintable_CRLF()