diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-12-27 17:33:52 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-12-27 17:44:53 -0500 |
commit | 21f053e2dd2867489a4d5823d9210c4368f4d115 (patch) | |
tree | 93191e7ef4de1fbe62060deab48febc27748b539 /sc/qa/unit | |
parent | 2e359fbb18286d0f300c0267a188d82769d276de (diff) |
fdo#72874: Strip const-ness from pointer value when setting it to storage.
Else the pointer type would get demoted to a boolean type which would cause
the boolean version of overloaded function to get picked.
Change-Id: Ided7e8c67ef84b4323c8ad1123e0a2c30ce37e01
Diffstat (limited to 'sc/qa/unit')
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 41 | ||||
-rw-r--r-- | sc/qa/unit/ucalc.hxx | 2 |
2 files changed, 43 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 2f7e52c03834..17c4123d79e1 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -4106,6 +4106,47 @@ void Test::testSortWithFormulaRefs() pDoc->DeleteTab(1); } +void Test::testSortWithStrings() +{ + m_pDoc->InsertTab(0, "Test"); + + ScFieldEditEngine& rEE = m_pDoc->GetEditEngine(); + rEE.SetText("Val1"); + m_pDoc->SetString(ScAddress(1,1,0), "Header"); + m_pDoc->SetString(ScAddress(1,2,0), "Val2"); + m_pDoc->SetEditText(ScAddress(1,3,0), rEE.CreateTextObject()); + + CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(1,1,0))); + CPPUNIT_ASSERT_EQUAL(OUString("Val2"), m_pDoc->GetString(ScAddress(1,2,0))); + CPPUNIT_ASSERT_EQUAL(OUString("Val1"), m_pDoc->GetString(ScAddress(1,3,0))); + + ScSortParam aParam; + aParam.nCol1 = 1; + aParam.nCol2 = 1; + aParam.nRow1 = 1; + aParam.nRow2 = 3; + aParam.bHasHeader = true; + aParam.maKeyState[0].bDoSort = true; + aParam.maKeyState[0].bAscending = true; + aParam.maKeyState[0].nField = 1; + + m_pDoc->Sort(0, aParam, false, NULL); + + CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(1,1,0))); + CPPUNIT_ASSERT_EQUAL(OUString("Val1"), m_pDoc->GetString(ScAddress(1,2,0))); + CPPUNIT_ASSERT_EQUAL(OUString("Val2"), m_pDoc->GetString(ScAddress(1,3,0))); + + aParam.maKeyState[0].bAscending = false; + + m_pDoc->Sort(0, aParam, false, NULL); + + CPPUNIT_ASSERT_EQUAL(OUString("Header"), m_pDoc->GetString(ScAddress(1,1,0))); + CPPUNIT_ASSERT_EQUAL(OUString("Val2"), m_pDoc->GetString(ScAddress(1,2,0))); + CPPUNIT_ASSERT_EQUAL(OUString("Val1"), m_pDoc->GetString(ScAddress(1,3,0))); + + m_pDoc->DeleteTab(0); +} + void Test::testSort() { OUString aTabName1("test1"); diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index 2af0e6545402..771a044579cb 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -275,6 +275,7 @@ public: void testFindAreaPosColRight(); void testSort(); void testSortWithFormulaRefs(); + void testSortWithStrings(); void testShiftCells(); void testNoteDeleteRow(); void testNoteDeleteCol(); @@ -385,6 +386,7 @@ public: CPPUNIT_TEST(testFindAreaPosColRight); CPPUNIT_TEST(testSort); CPPUNIT_TEST(testSortWithFormulaRefs); + CPPUNIT_TEST(testSortWithStrings); CPPUNIT_TEST(testShiftCells); CPPUNIT_TEST(testNoteDeleteRow); CPPUNIT_TEST(testNoteDeleteCol); |