You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by da...@apache.org on 2015/11/03 19:44:21 UTC

svn commit: r1712367 - in /openoffice/trunk: main/sc/source/core/data/table6.cxx test/testgui/data/bvt/searchFormulasValues.ods test/testgui/source/bvt/gui/BasicFunctionTest.java test/testgui/source/testlib/gui/UIMap.java

Author: damjan
Date: Tue Nov  3 18:44:21 2015
New Revision: 1712367

URL: http://svn.apache.org/viewvc?rev=1712367&view=rev
Log:
#i60307# search for strings in date formats fails.
When "Search in" is set to "Values", search the formatted values
instead of just the raw input. This fixes a 9 year old
bug that's been duplicated at least 6 times, and matches what Excel
does. Tests show even "Replace" works, and works well: if
"October" is replaced by "November", it converts the original
month from 10 to 11; it only converts the cell type to text if the
resulting text is no longer a valid date. Also added BVT tests
for the expected behaviour.


Added:
    openoffice/trunk/test/testgui/data/bvt/searchFormulasValues.ods   (with props)
Modified:
    openoffice/trunk/main/sc/source/core/data/table6.cxx
    openoffice/trunk/test/testgui/source/bvt/gui/BasicFunctionTest.java
    openoffice/trunk/test/testgui/source/testlib/gui/UIMap.java

Modified: openoffice/trunk/main/sc/source/core/data/table6.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/core/data/table6.cxx?rev=1712367&r1=1712366&r2=1712367&view=diff
==============================================================================
--- openoffice/trunk/main/sc/source/core/data/table6.cxx (original)
+++ openoffice/trunk/main/sc/source/core/data/table6.cxx Tue Nov  3 18:44:21 2015
@@ -91,7 +91,7 @@ sal_Bool ScTable::SearchCell(const SvxSe
 					bMultiLine = lcl_GetTextWithBreaks(
 						*(const ScEditCell*)pCell, pDocument, aString );
 				else
-					aCol[nCol].GetInputString( nRow, aString );
+					aCol[nCol].GetString( nRow, aString );
 				break;
 			case SVX_SEARCHIN_NOTE:
 				{

Added: openoffice/trunk/test/testgui/data/bvt/searchFormulasValues.ods
URL: http://svn.apache.org/viewvc/openoffice/trunk/test/testgui/data/bvt/searchFormulasValues.ods?rev=1712367&view=auto
==============================================================================
Binary file - no diff available.

Propchange: openoffice/trunk/test/testgui/data/bvt/searchFormulasValues.ods
------------------------------------------------------------------------------
    svn:mime-type = application/vnd.oasis.opendocument.spreadsheet

Modified: openoffice/trunk/test/testgui/source/bvt/gui/BasicFunctionTest.java
URL: http://svn.apache.org/viewvc/openoffice/trunk/test/testgui/source/bvt/gui/BasicFunctionTest.java?rev=1712367&r1=1712366&r2=1712367&view=diff
==============================================================================
--- openoffice/trunk/test/testgui/source/bvt/gui/BasicFunctionTest.java (original)
+++ openoffice/trunk/test/testgui/source/bvt/gui/BasicFunctionTest.java Tue Nov  3 18:44:21 2015
@@ -327,6 +327,36 @@ public class BasicFunctionTest {
 				copyAll());
 		discard();
 	}
+	
+	@Test
+	public void testFindFormulasAndValues() {
+	    open(prepareData("bvt/searchFormulasValues.ods"));
+	    calc.waitForExistence(10, 2);
+	    
+	    // Searching for 2003 by formula finds A2
+	    SCTool.selectRange("A1");
+	    app.dispatch(".uno:SearchDialog");
+        findDlgFor.setText("2003");
+        findDlgMore.click();
+        findDlgCalcSearchIn.select("Formulas");
+        findDlgFind.click();
+        sleep(1);
+	    assertEquals("wrong cell found for formulas search", "A2", scInputBarPosition.getText());
+	    findDlg.close();
+	    
+	    // Searching for October by value finds A2
+	    SCTool.selectRange("A1");
+	    app.dispatch(".uno:SearchDialog");
+	    findDlgFor.setText("October");
+	    findDlgMore.click();
+	    findDlgCalcSearchIn.select("Values");
+	    findDlgFind.click();
+	    sleep(1);
+	    assertEquals("wrong cell found for values search", "A2", scInputBarPosition.getText());
+	    findDlg.close();
+	    
+	    discard();
+	}
 
 	@Test
 	public void testFillInSpreadsheet() {

Modified: openoffice/trunk/test/testgui/source/testlib/gui/UIMap.java
URL: http://svn.apache.org/viewvc/openoffice/trunk/test/testgui/source/testlib/gui/UIMap.java?rev=1712367&r1=1712366&r2=1712367&view=diff
==============================================================================
--- openoffice/trunk/test/testgui/source/testlib/gui/UIMap.java (original)
+++ openoffice/trunk/test/testgui/source/testlib/gui/UIMap.java Tue Nov  3 18:44:21 2015
@@ -181,6 +181,7 @@ public class UIMap {
 	public static final VclButton findDlgMatchCase = button("svx:CheckBox:RID_SVXDLG_SEARCH:CB_MATCH_CASE");
 	public static final VclButton findDlgWholeWord = button("svx:CheckBox:RID_SVXDLG_SEARCH:CB_WHOLE_WORDS");
 	public static final VclButton findDlgMore = button("svx:MoreButton:RID_SVXDLG_SEARCH:BTN_MORE");
+	public static final VclListBox findDlgCalcSearchIn = listbox("svx:ListBox:RID_SVXDLG_SEARCH:LB_CALC_SEARCHIN");
 	public static final VclWindow chart = window("CHART2_HID_SCH_WIN_DOCUMENT");
 	public static final VclDialog chartWizard = dialog("CHART2_HID_SCH_CHART_AUTO_FORMAT");
 	public static final VclDialog filePrintDlg = dialog(".HelpID:vcl:PrintDialog:Dialog");