This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch symphony-vba in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit e3db34fdaff1dcb466f0de843ab79356924e0644 Author: Pedro Giffuni <[email protected]> AuthorDate: Fri Nov 6 01:14:22 2026 -0500 Improve VBA test comments with MS VBA spec and compliance notes --- main/sc/qa/vba/src/VbaDictionaryTest.java | 38 ++++++++++++++------------ main/sc/qa/vba/src/VbaFormatConditionTest.java | 29 ++++++++++++-------- main/sc/qa/vba/src/VbaQueryTableTest.java | 28 ++++++++++--------- main/sc/qa/vba/src/VbaSaveAsTest.java | 31 ++++++++++++--------- 4 files changed, 71 insertions(+), 55 deletions(-) diff --git a/main/sc/qa/vba/src/VbaDictionaryTest.java b/main/sc/qa/vba/src/VbaDictionaryTest.java index 5b06d2150b..1aeb46dc88 100644 --- a/main/sc/qa/vba/src/VbaDictionaryTest.java +++ b/main/sc/qa/vba/src/VbaDictionaryTest.java @@ -29,24 +29,28 @@ import static org.junit.Assert.*; /** * P3: Tests for VBA Scripting.Dictionary (ooo.vba.Scripting.Dictionary). * - * Tests the following VBA object model features: - * - CreateObject("Scripting.Dictionary") returns a Dictionary object - * - Dictionary.Add adds key-value pairs - * - Dictionary.Item (default property) get/set - * - Dictionary.Exists checks if key exists - * - Dictionary.Count returns number of items - * - Dictionary.Remove removes a key - * - Dictionary.RemoveAll removes all keys - * - Dictionary.Keys returns array of keys - * - Dictionary.Items returns array of values - * - Dictionary.CompareMode get/set - * - Dictionary.Key renames a key + * MS VBA reference (mined from MicrosoftDocs/VBA-Docs): + * - Add(key, item): Adds key/item pair; error if key already exists. + * - Exists(key): True if key exists, False otherwise. + * - Item(key) [default, read/write]: Returns/sets item for key. If key not found when + * changing an item, a new key is created with newitem. If key not found when reading, + * a new key is created and its item is left empty. + * - Remove(key): Removes key/item pair; error if key does not exist. + * - RemoveAll(): Removes all key/item pairs. + * - Keys(): Array of all existing keys. + * - Items(): Array of all items. + * - Count: Read-only Long number of key/item pairs. + * - CompareMode: vbUseCompareOption(-1), vbBinaryCompare(0), vbTextCompare(1), + * vbDatabaseCompare(2). Changing CompareMode on a Dictionary that already contains data + * causes an error. + * - Key(key) = newkey: Sets a key; run-time error if key not found. * - * The AOO implementation (vbadictionary.cxx) matches the - * Scripting.Dictionary interface. See XDictionary.idl. - * - * Test methodology: BASIC macros create Dictionary objects and exercise - * methods. Results written to Z column (index 25). + * AOO compliance notes (vbadictionary.cxx/XDictionary.idl): + * - Implements Add/Exists/Item/Remove/RemoveAll/Keys/Items/Count/CompareMode and Key via + * XInvocation. CompareMode is stored but "cannot change when non-empty" is not enforced + * (see testCompareModeWithItems - currently lenient). Reading a missing Item returns an + * empty Any rather than auto-creating an empty entry on read (behavioral difference from + * strict VBA Item semantics). * * Result columns: * - Z column (index 25): numeric results diff --git a/main/sc/qa/vba/src/VbaFormatConditionTest.java b/main/sc/qa/vba/src/VbaFormatConditionTest.java index 56c40bdb57..8e10ffa4dd 100644 --- a/main/sc/qa/vba/src/VbaFormatConditionTest.java +++ b/main/sc/qa/vba/src/VbaFormatConditionTest.java @@ -29,23 +29,28 @@ import static org.junit.Assert.*; /** * P1: Tests for VBA FormatCondition and FormatConditions APIs. * - * Tests the following VBA object model features: - * - Range.FormatConditions.Add with xlExpression and xlCellValue types - * - FormatCondition.Type, Formula1, Formula2, Operator properties - * - FormatCondition.Modify to change existing conditions - * - FormatCondition.Delete to remove individual conditions - * - FormatConditions.Delete to remove all conditions - * - FormatConditions.Count and Item collection access - * - For Each enumeration over FormatConditions + * MS VBA reference (mined from MicrosoftDocs/VBA-Docs): + * - FormatConditions.Add(Type, Operator, Formula1, Formula2): Adds a new conditional format. + * Type is XlFormatConditionType (xlCellValue or xlExpression). Operator is + * XlFormatConditionOperator (xlBetween, xlEqual, xlGreater, xlGreaterEqual, xlLess, + * xlLessEqual, xlNotBetween, xlNotEqual); ignored if Type is xlExpression. Formula1/2 + * can be constant/string/cell ref/formula; Formula2 used for xlBetween/xlNotBetween. + * - FormatCondition.Modify(Type, Operator, Formula1, Formula2): Modifies an existing + * conditional format with the same parameter semantics as Add. + * - FormatCondition.Delete: Deletes the object. + * - FormatCondition properties: Type, Operator, Formula1, Formula2, plus formatting + * (Font, Borders, Interior, NumberFormat, etc.) and priority/scope properties. + * + * AOO compliance notes (vbaformatcondition*.cxx): + * - Core Add/Modify/Delete/Type/Operator/Formula1/Formula2 are implemented. + * - getA1Formula in FormatConditions currently does not convert R1C1 to A1 (hook/TODO). + * - Some Excel FormatCondition properties (Priority, StopIfTrue, AppliesTo, etc.) may be + * absent depending on XFormatCondition.idl coverage. * * Reference Excel constants: * - XlFormatConditionType: xlCellValue=1, xlExpression=2 * - XlFormatConditionOperator: xlBetween=1, xlEqual=3, xlGreater=5, * xlGreaterEqual=7, xlLess=6, xlLessEqual=8, xlNotBetween=2, xlNotEqual=4 - * - * Test methodology: BASIC macros exercise the VBA APIs and write results - * to cells Z1, Z2, etc. (column 25). Java code verifies via UNO. - * Follows AAA pattern with '@TestMethod' markers in comments. */ public class VbaFormatConditionTest extends VbaCompatTest { diff --git a/main/sc/qa/vba/src/VbaQueryTableTest.java b/main/sc/qa/vba/src/VbaQueryTableTest.java index 0705fe5c9d..80b68322bb 100644 --- a/main/sc/qa/vba/src/VbaQueryTableTest.java +++ b/main/sc/qa/vba/src/VbaQueryTableTest.java @@ -29,20 +29,22 @@ import static org.junit.Assert.*; /** * P3: Tests for VBA Range.QueryTable API. * - * Tests the following VBA object model features: - * - Range.QueryTable returns a QueryTable object (not Nothing) - * - QueryTable.Refresh method (returns Boolean indicating if link was updated) - * - QueryTable.Delete method (removes from internal link manager) - * - QueryTable.Refresh with background query parameter + * MS VBA reference (mined from MicrosoftDocs/VBA-Docs): + * - QueryTable.Refresh(BackgroundQuery): Updates external data range. Returns Boolean - + * True if query successfully completed or started; False if user cancels a + * connection/parameter dialog. BackgroundQuery controls async behavior for SQL-based + * QueryTables; if omitted, BackgroundQuery property determines mode. + * - QueryTable.Delete: Deletes the QueryTable object. + * - Excel QueryTable also exposes Connection, CommandText, Destination, Parameters, + * BackgroundQuery, RefreshStyle, SaveData, and many TextFile*/Web* properties; AOO's + * XQueryTable.idl currently exposes only Refresh/Delete. * - * Note: The current AOO QueryTable implementation (vbaquerytable.cxx) - * only implements Refresh and Delete. Properties like Connection, - * CommandText, Destination are NOT implemented per the IDL. - * Tests on a plain range (without external data links) verify that - * these methods do not throw and return appropriate values. - * - * Test methodology: BASIC macros access Range.QueryTable and call - * methods. Results written to Z column (index 25). + * AOO compliance notes (vbaquerytable.cxx): + * - Refresh searches LinkManager for an ScAreaLink whose destination contains the parent + * range and updates it. Returns True if any matching area link was found/updated, + * False otherwise. This is an area-link approximation, not full ODBC/SQL query behavior. + * - BackgroundQuery is accepted but not used for async control. + * - On a plain range with no external data link, tests expect Refresh to return False. * * Result columns: * - Z column (index 25): numeric results (1 = success/true, 0 = failure/false) diff --git a/main/sc/qa/vba/src/VbaSaveAsTest.java b/main/sc/qa/vba/src/VbaSaveAsTest.java index 0f832d527b..e1d100de71 100644 --- a/main/sc/qa/vba/src/VbaSaveAsTest.java +++ b/main/sc/qa/vba/src/VbaSaveAsTest.java @@ -31,20 +31,25 @@ import static org.junit.Assert.*; /** * P2: Tests for VBA Workbook.SaveAs API. * - * Tests the following VBA object model features: - * - ThisWorkbook.SaveAs with xlCSV format - * - ThisWorkbook.SaveAs with xlExcel9795 format - * - File creation verification after SaveAs - * - SaveAs with overwrite behavior (second save to same path) - * - SaveAs with default format (no explicit format parameter) + * MS VBA reference (mined from MicrosoftDocs/VBA-Docs, Workbook.SaveAs): + * Syntax: expression.SaveAs(FileName, FileFormat, Password, WriteResPassword, + * ReadOnlyRecommended, CreateBackup, AccessMode, ConflictResolution, AddToMru, + * TextCodepage, TextVisualLayout, Local) + * - FileName: name/path of file to save; if no full path, Excel saves in current folder. + * - FileFormat: XlFileFormat value; default for existing file is last format specified, + * default for new file is format of Excel version being used. + * - Password/WriteResPassword: protection passwords (case-sensitive, <=15 chars). + * - ReadOnlyRecommended/CreateBackup/AccessMode/ConflictResolution/AddToMru: file behavior. + * - TextCodepage/TextVisualLayout: ignored for all languages in Excel (CSV/text saving uses + * system locale code page/logical layout). + * - Local: True saves against Excel language; False (default) against VBA language. * - * Reference Excel constants: - * - xlCSV = 6 - * - xlExcel9795 = 43 - * - * Test methodology: BASIC macros call SaveAs to save the document to a - * temp path, then Java verifies the file exists on disk. Uses temp - * directory created by Java for deterministic file operations. + * AOO compliance notes (vbaworkbook.cxx/SaveAs): + * - Implements FileName, FileFormat, Password, WriteResPassword, ReadOnlyRecommended, + * CreateBackup. Appends extension if FileName has no dot. Defaults FileFormat to + * xlExcel9795 (MS Excel 97 filter) when omitted. + * - AccessMode, ConflictResolution, AddToMru, TextCodepage, TextVisualLayout, Local are + * not implemented (current XWorkbook.SaveAs IDL has 6 parameters). * * Result columns: * - Z column (index 25): numeric results (1 = success)
