editeng/qa/unit/core-test.cxx | 46 ++++++++++++++++++++++++++++++++++++++++++ sal/osl/w32/file.cxx | 24 +++++++++------------ 2 files changed, 56 insertions(+), 14 deletions(-)
New commits: commit fd9ac19838b4d97262a7c4411d80c2d64e54d653 Author: Chris Sherlock <chris.sherloc...@gmail.com> Date: Fri Jun 23 08:42:42 2017 +1000 osl: w32/file.cxx update comments Change-Id: I837db449b4e1eb16580bbfd57647f6372b43e4d8 Reviewed-on: https://gerrit.libreoffice.org/39143 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sal/osl/w32/file.cxx b/sal/osl/w32/file.cxx index 207c18c7eaef..cb4d2e5e8bab 100644 --- a/sal/osl/w32/file.cxx +++ b/sal/osl/w32/file.cxx @@ -43,8 +43,8 @@ #undef min #endif -// File handle implementation - +/** File handle implementation. +*/ struct FileHandle_Impl { CRITICAL_SECTION m_mutex; @@ -54,19 +54,19 @@ struct FileHandle_Impl */ enum StateBits { - STATE_SEEKABLE = 1, /* open() sets, iff regular file */ - STATE_READABLE = 2, /* open() sets, read() requires */ - STATE_WRITEABLE = 4, /* open() sets, write() requires */ + STATE_SEEKABLE = 1, /*< open() sets, iff regular file */ + STATE_READABLE = 2, /*< open() sets, read() requires */ + STATE_WRITEABLE = 4, /*< open() sets, write() requires */ STATE_MODIFIED = 8 /* write() sets, flush() resets */ }; int m_state; - sal_uInt64 m_size; /* file size */ - LONGLONG m_offset; /* physical offset from begin of file */ - LONGLONG m_filepos; /* logical offset from begin of file */ + sal_uInt64 m_size; /*< file size */ + LONGLONG m_offset; /*< physical offset from begin of file */ + LONGLONG m_filepos; /*< logical offset from begin of file */ - LONGLONG m_bufptr; /* buffer offset from begin of file */ - SIZE_T m_buflen; /* buffer filled [0, m_bufsiz - 1] */ + LONGLONG m_bufptr; /*< buffer offset from begin of file */ + SIZE_T m_buflen; /*< buffer filled [0, m_bufsiz - 1] */ SIZE_T m_bufsiz; sal_uInt8 * m_buffer; @@ -664,8 +664,6 @@ oslFileError FileHandle_Impl::syncFile() return result; } -// File I/O functions - extern "C" oslFileHandle SAL_CALL osl_createFileHandleFromOSHandle ( HANDLE hFile, @@ -1090,8 +1088,6 @@ SAL_CALL osl_setFileSize (oslFileHandle Handle, sal_uInt64 uSize) return pImpl->setSize (uSize); } -// File handling functions - oslFileError SAL_CALL osl_removeFile( rtl_uString* strPath ) { rtl_uString *strSysPath = nullptr; commit 84284429de635226342d745680fa5ddc324b4b3b Author: Varun Dhall <varun.dh...@studentpartner.com> Date: Thu Jun 22 22:05:21 2017 +0530 EditEngine: Added test to check Multi Para Copy/Paste Change-Id: Ida45d5861068c71e5c8d75eb711aaacbf543be79 Reviewed-on: https://gerrit.libreoffice.org/39119 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Michael Stahl <mst...@redhat.com> diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx index 1f67db2b479a..0249c0d0f4bf 100644 --- a/editeng/qa/unit/core-test.cxx +++ b/editeng/qa/unit/core-test.cxx @@ -72,6 +72,9 @@ public: /// Test Copy/Paste with Underline text using Legacy Format void testUnderlineCopyPaste(); + /// Test Copy/Paste with mutiple paragraphs + void testMultiParaCopyPaste(); + void testSectionAttributes(); CPPUNIT_TEST_SUITE(Test); @@ -84,6 +87,7 @@ public: CPPUNIT_TEST(testHyperlinkSearch); CPPUNIT_TEST(testBoldItalicCopyPaste); CPPUNIT_TEST(testUnderlineCopyPaste); + CPPUNIT_TEST(testMultiParaCopyPaste); CPPUNIT_TEST(testSectionAttributes); CPPUNIT_TEST_SUITE_END(); @@ -1035,6 +1039,48 @@ void Test::testUnderlineCopyPaste() CPPUNIT_ASSERT_MESSAGE( "This section must be underlined.", hasUnderline(*pSecAttr) ); } +void Test::testMultiParaCopyPaste() +{ + // Create EditEngine's instance + EditEngine aEditEngine( mpItemPool ); + + // Get EditDoc for current EditEngine's instance + EditDoc &rDoc = aEditEngine.GetEditDoc(); + + // Initially no text should be there + CPPUNIT_ASSERT_EQUAL( sal_uLong(0), rDoc.GetTextLen() ); + CPPUNIT_ASSERT_EQUAL( OUString(), rDoc.GetParaAsString(sal_Int32(0)) ); + + // Insert initial text + OUString aFirstPara = "This is first paragraph"; + OUString aSecondPara = "This is second paragraph"; + OUString aThirdPara = "This is third paragraph"; + OUString aText = aFirstPara + "\n" + aSecondPara + "\n" + aThirdPara; + sal_Int32 aTextLen = aFirstPara.getLength() + aSecondPara.getLength() + aThirdPara.getLength(); + aEditEngine.SetText( aText ); + sal_Int32 aCopyTextLen = aFirstPara.getLength() + aSecondPara.getLength(); + + // Assert changes + CPPUNIT_ASSERT_EQUAL( sal_uLong(aTextLen), rDoc.GetTextLen() ); + CPPUNIT_ASSERT_EQUAL( aFirstPara, rDoc.GetParaAsString(sal_Int32(0)) ); + CPPUNIT_ASSERT_EQUAL( aSecondPara, rDoc.GetParaAsString(sal_Int32(1)) ); + CPPUNIT_ASSERT_EQUAL( aThirdPara, rDoc.GetParaAsString(sal_Int32(2)) ); + + // Copy initial text using legacy format + uno::Reference< datatransfer::XTransferable > xData = aEditEngine.CreateTransferable( ESelection(0,0,1,aSecondPara.getLength()) ); + + // Paste text at the end + aEditEngine.InsertText( xData, OUString(), rDoc.GetEndPaM(), true ); + + // Assert changes + OUString aThirdParaAfterCopyPaste = aThirdPara + aFirstPara; + CPPUNIT_ASSERT_EQUAL( sal_uLong(aTextLen + aCopyTextLen), rDoc.GetTextLen() ); + CPPUNIT_ASSERT_EQUAL( aFirstPara, rDoc.GetParaAsString(sal_Int32(0)) ); + CPPUNIT_ASSERT_EQUAL( aSecondPara, rDoc.GetParaAsString(sal_Int32(1)) ); + CPPUNIT_ASSERT_EQUAL( aThirdParaAfterCopyPaste, rDoc.GetParaAsString(sal_Int32(2)) ); + CPPUNIT_ASSERT_EQUAL( aSecondPara, rDoc.GetParaAsString(sal_Int32(3)) ); +} + void Test::testSectionAttributes() { EditEngine aEngine(mpItemPool); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits