diff --git a/BUGS-TO-REPORT.md b/BUGS-TO-REPORT.md index 926f5afb7..c76a51659 100644 --- a/BUGS-TO-REPORT.md +++ b/BUGS-TO-REPORT.md @@ -14136,7 +14136,7 @@ Steps to reproduce the behavior: 2. Load it and open a project. **ProbeFirst** is on the menu bar after **Help**. 3. Click **ProbeFirst**. Nothing opens. 4. `m.Caption = "ProbeFirst2"` leaves the bar item's text as it was; `m.Caption` reads `ProbeFirst2`. -5. Restart the compiler. The bar now shows **ProbeFirst** twice. +5. Restart the compiler. The bar now shows **ProbeFirst** twice, and neither opens. **Expected behavior** The menu opens on a click and lists its entries, as it does when the add-in has added an entry somewhere else first; its `Caption` and `Visible` change the bar item; a compiler restart removes it. @@ -14150,7 +14150,7 @@ In `ide/main.js`, the `addMenu` handler, for a menu with no parent, inserts the Severity: medium. An add-in whose only menu is its own gets a menu that does nothing, and a growing row of them. - + --- @@ -14177,7 +14177,7 @@ The page has a handler for one menu's removal (`removeAllMenuChildren`) and none Severity: low. An add-in can remove its entries one menu at a time. - + --- @@ -14283,9 +14283,11 @@ The variables in an open tool window change with the theme, as they do in a desi **Additional context** `createToolWindowById` in `ide/main.js` copies the eight values onto the tool window's body as inline styles when it makes the window, and nothing copies them again; `resyncTheme`, which `notifyChangedTheme` calls, does it for designers only. The inline values hide the page's own, which do change. -Severity: low. An add-in can make its windows again in `OnChangedTheme`. +A `datasheet` in such a tool window keeps the old theme too: it reads the variables from its root, which computes the window's stale values, so after a switch from Dark to Light it goes on painting Dark's colours. - +Severity: low. An add-in can set its own elements' colours in `OnChangedTheme`, but not a datasheet's, which reads only the variables. + + --- @@ -14312,35 +14314,36 @@ A cell is drawn by fin-hypergrid's default renderer (`ide/fin-hypergrid.min.js`) Severity: medium. A table of numbers shows blanks where its zeros are, with nothing to say so. - + --- -## Right, Left, Tab, Home and End in a datasheet throw in the IDE's page and move nothing +## Home and End in a datasheet throw, and after Up or Down so do Right, Left, Tab and Shift+Down **Describe the bug** -In a `datasheet` with a data cell current, Up and Down move the current record. Right, Left and Tab each throw `TypeError: Cannot read properties of null (reading 'x')` from `ide/fin-hypergrid.min.js`, and Home, End, Ctrl+Home and Ctrl+End throw `page left not yet implemented` or `page right not yet implemented`. None of them moves the cell, the record or the scroll. It was observed in an IDE started with an `APPDATA` of its own, with a probe add-in (`test/addin/probes/datasheet`) that shows a datasheet in a tool window. +In a `datasheet`, Home, End, Ctrl+Home and Ctrl+End always throw `page left not yet implemented` or `page right not yet implemented` from `ide/fin-hypergrid.min.js`, and move nothing. Right, Left and Tab move the current cell, and Shift+Down the current record, after a click on a data cell; but once Up or Down has moved the current record, each of the four throws `TypeError: Cannot read properties of null (reading 'x')` from the same file and moves nothing, until the next click. Up and Down go on working. None of the keys that throw moves the cell, the record or the scroll. It was observed in an IDE started with an `APPDATA` of its own, with a probe add-in (`test/addin/probes/datasheet`) that shows a datasheet in a tool window. **To Reproduce** Steps to reproduce the behavior: 1. A datasheet with a few columns and rows. Click a data cell. -2. Press Right. Nothing moves; the page reports an uncaught TypeError. -3. Press Home. Nothing moves; the page reports `page left not yet implemented`. -Control: Down moves the current record by one. +2. Press Home. Nothing moves; the page reports `page left not yet implemented`. End, Ctrl+Home and Ctrl+End do the same. +3. Click a data cell, then press Down: the current record moves down one. +4. Press Right. Nothing moves; the page reports an uncaught TypeError. Left, Tab and Shift+Down do the same, until the next click. +Control: Right pressed straight after a click moves the current cell one column right. **Expected behavior** -Right, Left and Tab move to the next or previous cell, scrolling the columns into view, and Home and End to the first or last column; or the keys do nothing without an error. +Right, Left, Tab and Shift+Down do what they do after a click whichever key moved the current record, and Home and End move to the first or last column; or the keys do nothing without an error. **Desktop:** - OS: Windows 10 Pro 22H2 (build 19045) - twinBASIC compiler version: BETA 1045 **Additional context** -The two strings are fin-hypergrid's own unfinished handlers. The TypeError is in its cell navigation, which finds no cell selection of its own: the datasheet keeps its current record itself and handles Up and Down. +The two strings are fin-hypergrid's own unfinished handlers. The TypeError is in its cell navigation, which finds no cell selection of its own: the datasheet keeps its current record itself and handles Up and Down, and a click sets fin-hypergrid's selection again. -Severity: low. A grid wider than its window can be scrolled sideways only with the scroll bar. +Severity: low. A grid wider than its window can be scrolled sideways only with the scroll bar once Up or Down has been used. - + --- @@ -14394,7 +14397,7 @@ In `ide/main.js`, `fileHandler_CustomDesigner.isDirty` sets `cachedIsDirtyState` Severity: low. The tab says it has changes it does not have. - + --- @@ -14492,3 +14495,91 @@ Severity: high for 32-bit drivers: no `__fastcall` routine of the kernel can be +--- + +## A `Collection` whose `KeyCompareMode` is `vbBinaryCompare` adds an item with a `vbNullString` key with no key at all + +**Describe the bug** +`Collection.Add Item, Key` with a *Key* that is `vbNullString` (a `String` variable never assigned, whose `StrPtr` is 0) stores the item under the key `""` when the collection's `KeyCompareMode` is `vbTextCompare`, the default. When it is `vbBinaryCompare`, the same call adds the item with no key: `Count` goes up, but `Exists("")` is `False`, `Item("")` raises 5, *Invalid procedure call or argument*, and `Keys` has no entry for it. No error is raised by the `Add`. The literal `""` works in both modes, and `vbNullString = ""` is `True`, so the two values are one key everywhere else. + +**To Reproduce** +Steps to reproduce the behavior: +1. Open `collection-binary-nullstring-key.twinproj` (attached as `collection-binary-nullstring-key.zip`). +2. Run its test cases, the module below. On BETA 1045 the two controls pass and the three other cases fail. + +The module is meant to be adapted as a regression test. +```vb +' Regression tests: a Collection whose KeyCompareMode is vbBinaryCompare keeps an item added +' with a vbNullString key under the key "", as the same Collection does with +' vbTextCompare, and as it does with the key "" written as a literal. On BETA 1045 the item +' is added with no key: Count goes up, but Exists("") is False, Item("") raises 5 and Keys +' has no entry. vbNullString and "" are the same String value (vbNullString = "" is True); +' they differ only in StrPtr, which is 0 for vbNullString. +' tbrun --tests runs each case and prints PASS or FAIL. +[TestFixture] +Module RegressionTests + + ' A Collection with one item, 1, added under `Key` with the compare mode given. + Private Function OneItem(ByVal Mode As VbCompareMethod, ByVal Key As String) As Collection + Dim c As New Collection + c.KeyCompareMode = Mode + c.Add 1, Key + Return c + End Function + + ' The item under the key "", or the error number that reading it raises, negated. + Private Function ItemOfEmptyKey(ByVal c As Collection) As Long + On Error Resume Next + ItemOfEmptyKey = c.Item("") + If Err.Number Then ItemOfEmptyKey = -Err.Number + End Function + + [TestCase] + Public Sub Control_TextCompare_NullStringKey_IsTheEmptyKey() + Dim c As Collection = OneItem(vbTextCompare, vbNullString) + Assert.Strict.IsTrue c.Exists("") + Assert.Strict.AreEqual 1&, ItemOfEmptyKey(c) + End Sub + + [TestCase] + Public Sub Control_BinaryCompare_LiteralEmptyKey_IsTheEmptyKey() + Dim c As Collection = OneItem(vbBinaryCompare, "") + Assert.Strict.IsTrue c.Exists("") + Assert.Strict.AreEqual 1&, ItemOfEmptyKey(c) + End Sub + + [TestCase] + Public Sub BinaryCompare_NullStringKey_Exists() + Assert.Strict.IsTrue OneItem(vbBinaryCompare, vbNullString).Exists("") + End Sub + + [TestCase] + Public Sub BinaryCompare_NullStringKey_ItemReadsIt() + Assert.Strict.AreEqual 1&, ItemOfEmptyKey(OneItem(vbBinaryCompare, vbNullString)) + End Sub + + [TestCase] + Public Sub BinaryCompare_NullStringKey_IsInKeys() + Dim k As Variant = OneItem(vbBinaryCompare, vbNullString).Keys + Assert.Strict.AreEqual 1&, CLng(UBound(k) - LBound(k) + 1) + End Sub + +End Module +``` + +**Expected behavior** +The item is stored under the key `""`, as with `vbTextCompare` and as with the literal `""` in either mode: `Exists("")` is `True`, `Item("")` returns it, and `Keys` lists `""`. + +**Desktop:** + - OS: Windows 10 Pro 22H2 (build 19045) + - twinBASIC compiler version: BETA 1045 + +**Additional context** +Severity: medium: the item is still counted and still enumerated, so nothing fails until a lookup by its key, which then raises 5 for a key the program did add. A `String` that holds text a program built up from nothing is often `vbNullString`. The contributed package VBA_JSON 2.3.2.1 meets it: its `Dictionary` class now sets `vbBinaryCompare` on its backing `Collection`, and its parser builds an object's key from nothing, so `ParseJson("{"""":1}")` gives a `Dictionary` with no keys, and reading the key `""` raises 5. VBA_JSON 2.3.1.1, on the text compare, kept the key. + +A 64-bit build gives the same results. VB6 and VBA cannot be compared: their `Collection` has no `KeyCompareMode`, and always compares keys as text. + +What does not reproduce it: the literal `""` as the key with `vbBinaryCompare`, and `vbNullString` as the key with `vbTextCompare` or with the compare mode left at its default. + + + diff --git a/WIP.Harness.md b/WIP.Harness.md index e1b808a97..1ff1d6a89 100644 --- a/WIP.Harness.md +++ b/WIP.Harness.md @@ -1824,8 +1824,11 @@ others are Stage 2's probe lanes: five codes `event_output` reads from the compiler's own output, the other for `&HFD0000`, the native-exception code. The scenario reads each line's HTML from `debugConsoleContent.dataNodes` and the colour its class gives, and `g_TraceMode`. About 15 s. +- The tbIDE lanes of BETA 1045, `designers`, `menus`, `datasheet` and `ico-cur`, are described in + [WIP.tbIDE.md](WIP.tbIDE.md#the-beta-1045-surface), with their times. The lanes `references`, + `parent`, `widgets`, `detach`, `help` and `help-offline` are described in their files' headers. -**Timing:** the lanes other than widgets (24 s alone) take about two minutes at the default two at a time +**Timing:** the lanes before BETA 1045's, other than widgets (24 s alone), take about two minutes at the default two at a time (the env lane is 16 s alone, the help lane 15 to 18 s, of which its cases are about 6 s). Typical lane costs: an add-in build about 10 s, a host IDE about 9 s, a scenario 2 s; the slowest lanes are arch (56 s: two builds and two switches of target) and reload (47 s: two builds and two restarts). diff --git a/WIP.Screenshots.md b/WIP.Screenshots.md index 2cbef9af2..66fffee25 100644 --- a/WIP.Screenshots.md +++ b/WIP.Screenshots.md @@ -1059,6 +1059,19 @@ line the page quotes. Its pictures are under `docs/IDE/Troubleshooting/Images/`. with `LoadResDataInternal`**, as the install's add-in samples do: `LoadResData` is the VB package's, which neither an add-in sample nor the Standard DLL template references (TB5079 without it); the class and the project must not share a name (TB5139). +- **`Restart_Without_Addins`** (index.md, *Rebuilding an addin the IDE has loaded*; Wayne + Phillips' procedure, which the owner tried by hand): a composite of the toolbar from the build + target box to the restart button, ringed with "+ Shift" under it, and an arrow to the console's + `[IDE] SHIFT KEY DETECTED: DISABLED LOADING OF ADDINS`. The restart is real: Shift is held in + the page by `Input.dispatchKeyEvent` (since BETA 1045 the page follows Shift by keydown and + keyup, not by the `tbMisc_ShiftKeyState…` commands), the button clicked, and MyAddIn's buttons + not coming back confirm the add-in did not load; a restart without Shift loads it again. The + restart prints `restarting from MEMORY []` above the line, so the setup opens + its project in `TbIde` under the tool's folder (`runFolder`, shown as `C:\tbshots\TbIde`, + removed by `endBuilding`): in the lane's work folder the path held the Windows user name. The + console is floated 110 px tall, which holds both lines in either theme: grown by `fitConsole` + it came out 19 px taller in dark than in Light. It is emptied while floated, since docked its + Clear button has no size. - **Docking is a real drag** (`dockAboveProperties`): the grip at the left of a floating panel's title bar starts the IDE's own drag on the press (a `dragstart` it makes itself), and the docked panels take HTML drag events, so the mouse is pressed on the grip and moved with diff --git a/WIP.tbIDE.md b/WIP.tbIDE.md index c2ef781f0..04784355d 100644 --- a/WIP.tbIDE.md +++ b/WIP.tbIDE.md @@ -235,9 +235,14 @@ the sources do not is measured by an add-in lane, and the lane's tests are the r |---|---|---| | `designers` | `test/addin/probes/designers`, `designers-host` | `Register` and the forms of `IconData`, the order of the `Designer` calls, `GetURI`, `SetFileData` and the dirty dot, the toolbox, `Editors.Open` with a designer, `Unregister` | | `menus` | `test/addin/probes/menus`, `menus-host`, `unsupported` | `Menu.Id` and `MenuEntry.Id`, placing an entry by `RelativeToCommand`, `BeforeShow`, `AddCustom`, `ShowPopup`, the removals, `SelectedItemPath`, `AddFileUI`, the `Addin*` theme colours, `UnsupportedHostAddin` and `Host.CompilerVersion` | -| `datasheet` | `test/addin/probes/datasheet` | the element in a tool window, `Ready()`, the four events and their answers, the controller's methods and what they return to twinBASIC, a failed answer | +| `datasheet` | `test/addin/probes/datasheet` | the element in a tool window, `Ready()`, the four events and their answers, the controller's methods and what they return to twinBASIC, a failed answer, the keys, the colours after a theme change | | `ico-cur` | the bundled ICO Designer | it refuses a `.cur` file | +A lane test that asserts an IDE defect says so in a comment and asserts only the defect; the +correct behaviour around it is a test of its own. A reproducer's `repro.json` names the defect's +tests only, so that `bug_repro.mjs verify` reports the defect fixed only when it is. Measured on +BETA 1045, one at a time: `designers` about 120 s, `menus` 56 s, `datasheet` 85 s. + Decisions the pages rest on: - **The datasheet has a page of its own**, `Datasheet.md` (owner: "in full (-ish)"), though it diff --git a/bugs/addcustom-first-menu-dead/repro.json b/bugs/addcustom-first-menu-dead/repro.json index 79dc0dbcf..b06fa6980 100644 --- a/bugs/addcustom-first-menu-dead/repro.json +++ b/bugs/addcustom-first-menu-dead/repro.json @@ -2,7 +2,8 @@ "mode": "lane", "lane": "addin:menus", "tests": [ - "AddCustom: a menu-bar item after Help; the add-in's first menu call gives one that does not open, and whose Caption and Visible do not change it" + "AddCustom: a menu-bar item after Help; the add-in's first menu call gives one that does not open, and whose Caption and Visible do not change it", + "after a compiler restart the dead ProbeFirst item stays beside the new one, which does not open either" ], - "steps": "1. An add-in whose `OnProjectLoaded` calls `Set m = Host.Menus.AddCustom(\"ProbeFirst\", True)` and `m.AddEntry \"One\"` before any other menu call.\n2. Load it and open a project. **ProbeFirst** is on the menu bar after **Help**.\n3. Click **ProbeFirst**. Nothing opens.\n4. `m.Caption = \"ProbeFirst2\"` leaves the bar item's text as it was; `m.Caption` reads `ProbeFirst2`.\n5. Restart the compiler. The bar now shows **ProbeFirst** twice." + "steps": "1. An add-in whose `OnProjectLoaded` calls `Set m = Host.Menus.AddCustom(\"ProbeFirst\", True)` and `m.AddEntry \"One\"` before any other menu call.\n2. Load it and open a project. **ProbeFirst** is on the menu bar after **Help**.\n3. Click **ProbeFirst**. Nothing opens.\n4. `m.Caption = \"ProbeFirst2\"` leaves the bar item's text as it was; `m.Caption` reads `ProbeFirst2`.\n5. Restart the compiler. The bar now shows **ProbeFirst** twice, and neither opens." } diff --git a/bugs/collection-binary-nullstring-key/collection-binary-nullstring-key.twinproj b/bugs/collection-binary-nullstring-key/collection-binary-nullstring-key.twinproj new file mode 100644 index 000000000..d0239a04d Binary files /dev/null and b/bugs/collection-binary-nullstring-key/collection-binary-nullstring-key.twinproj differ diff --git a/bugs/collection-binary-nullstring-key/repro.json b/bugs/collection-binary-nullstring-key/repro.json new file mode 100644 index 000000000..1c635fd9c --- /dev/null +++ b/bugs/collection-binary-nullstring-key/repro.json @@ -0,0 +1,13 @@ +{ + "mode": "test", + "expect": { + "exit": 7, + "output": [ + "^PASS RegressionTests.Control_TextCompare_NullStringKey_IsTheEmptyKey$", + "^PASS RegressionTests.Control_BinaryCompare_LiteralEmptyKey_IsTheEmptyKey$", + "^FAIL RegressionTests.BinaryCompare_NullStringKey_Exists: .*Expected: True Actual: False", + "^FAIL RegressionTests.BinaryCompare_NullStringKey_ItemReadsIt: .*Expected: 1 \\[Long\\] Actual: -5 \\[Long\\]", + "^FAIL RegressionTests.BinaryCompare_NullStringKey_IsInKeys: .*Expected: 1 \\[Long\\] Actual: 0 \\[Long\\]" + ] + } +} diff --git a/bugs/collection-binary-nullstring-key/src/Settings b/bugs/collection-binary-nullstring-key/src/Settings new file mode 100644 index 000000000..88178a352 --- /dev/null +++ b/bugs/collection-binary-nullstring-key/src/Settings @@ -0,0 +1,75 @@ +{ + "configuration.inherits": "Defaults", + "project.appTitle": "CollectionBinaryNullstringKey", + "project.buildPath": "${SourcePath}\\Build\\${ProjectName}_${Architecture}.${FileExtension}", + "project.buildType": "Standard EXE", + "project.description": "Reproduces: Collection with KeyCompareMode vbBinaryCompare adds an item with a vbNullString key with no key", + "project.exportPathIsV2": true, + "project.id": "{E8F691CA-E218-4E9C-A633-BF9DEBFEEFF0}", + "project.name": "CollectionBinaryNullstringKey", + "project.optionExplicit": true, + "project.references": [ + { + "id": "{00020430-0000-0000-C000-000000000046}", + "lcid": 0, + "name": "OLE Automation", + "path32": "C:\\Windows\\SysWOW64\\stdole2.tlb", + "path64": "C:\\Windows\\System32\\stdole2.tlb", + "symbolId": "stdole", + "versionMajor": 2, + "versionMinor": 0 + }, + { + "id": "{F50B82D0-DCAB-43FE-9631-11959D4A4728}", + "isCompilerPackage": true, + "licence": "MIT", + "name": "[COMPILER PACKAGE] twinBASIC - VB Compatibility Package (Forms)", + "path32": "", + "path64": "", + "publisher": "TWINBASIC-COMPILER", + "symbolId": "VB", + "versionBuild": 0, + "versionMajor": 0, + "versionMinor": 0, + "versionRevision": 31 + }, + { + "id": "{C192FB39-64CA-4D9B-B477-A5502F48EFCC}", + "isCompilerPackage": true, + "licence": "MIT", + "name": "[COMPILER PACKAGE] twinBASIC - App global class object", + "path32": "", + "path64": "", + "publisher": "TWINBASIC-COMPILER", + "symbolId": "AppGlobalClassProject", + "versionBuild": 0, + "versionMajor": 1, + "versionMinor": 0, + "versionRevision": 0 + }, + { + "id": "{9847A10D-8987-44B2-8B87-EA77DEF7F1D9}", + "isCompilerPackage": true, + "licence": "MIT", + "name": "[COMPILER PACKAGE] Assert", + "path32": "", + "path64": "", + "publisher": "TWINBASIC-COMPILER", + "symbolId": "Assert", + "versionBuild": 0, + "versionMajor": 0, + "versionMinor": 0, + "versionRevision": 24 + } + ], + "project.settingsVersion": 1, + "project.startupObject": "Sub Main", + "project.warnings": { + "errors": [], + "hints": [], + "ignored": [], + "info": [], + "warnings": [] + }, + "runtime.useUnicodeStandardLibrary": true +} diff --git a/bugs/collection-binary-nullstring-key/src/Sources/RegressionTests.twin b/bugs/collection-binary-nullstring-key/src/Sources/RegressionTests.twin new file mode 100644 index 000000000..7ed4c0031 --- /dev/null +++ b/bugs/collection-binary-nullstring-key/src/Sources/RegressionTests.twin @@ -0,0 +1,56 @@ +' Regression tests: a Collection whose KeyCompareMode is vbBinaryCompare keeps an item added +' with a vbNullString key under the key "", as the same Collection does with +' vbTextCompare, and as it does with the key "" written as a literal. On BETA 1045 the item +' is added with no key: Count goes up, but Exists("") is False, Item("") raises 5 and Keys +' has no entry. vbNullString and "" are the same String value (vbNullString = "" is True); +' they differ only in StrPtr, which is 0 for vbNullString. +' tbrun --tests runs each case and prints PASS or FAIL. +[TestFixture] +Module RegressionTests + + ' A Collection with one item, 1, added under `Key` with the compare mode given. + Private Function OneItem(ByVal Mode As VbCompareMethod, ByVal Key As String) As Collection + Dim c As New Collection + c.KeyCompareMode = Mode + c.Add 1, Key + Return c + End Function + + ' The item under the key "", or the error number that reading it raises, negated. + Private Function ItemOfEmptyKey(ByVal c As Collection) As Long + On Error Resume Next + ItemOfEmptyKey = c.Item("") + If Err.Number Then ItemOfEmptyKey = -Err.Number + End Function + + [TestCase] + Public Sub Control_TextCompare_NullStringKey_IsTheEmptyKey() + Dim c As Collection = OneItem(vbTextCompare, vbNullString) + Assert.Strict.IsTrue c.Exists("") + Assert.Strict.AreEqual 1&, ItemOfEmptyKey(c) + End Sub + + [TestCase] + Public Sub Control_BinaryCompare_LiteralEmptyKey_IsTheEmptyKey() + Dim c As Collection = OneItem(vbBinaryCompare, "") + Assert.Strict.IsTrue c.Exists("") + Assert.Strict.AreEqual 1&, ItemOfEmptyKey(c) + End Sub + + [TestCase] + Public Sub BinaryCompare_NullStringKey_Exists() + Assert.Strict.IsTrue OneItem(vbBinaryCompare, vbNullString).Exists("") + End Sub + + [TestCase] + Public Sub BinaryCompare_NullStringKey_ItemReadsIt() + Assert.Strict.AreEqual 1&, ItemOfEmptyKey(OneItem(vbBinaryCompare, vbNullString)) + End Sub + + [TestCase] + Public Sub BinaryCompare_NullStringKey_IsInKeys() + Dim k As Variant = OneItem(vbBinaryCompare, vbNullString).Keys + Assert.Strict.AreEqual 1&, CLng(UBound(k) - LBound(k) + 1) + End Sub + +End Module diff --git a/bugs/collection-binary-nullstring-key/src/Sources/Startup.twin b/bugs/collection-binary-nullstring-key/src/Sources/Startup.twin new file mode 100644 index 000000000..20233b3a9 --- /dev/null +++ b/bugs/collection-binary-nullstring-key/src/Sources/Startup.twin @@ -0,0 +1,6 @@ +Module Startup + + Public Sub Main() + End Sub + +End Module diff --git a/bugs/datasheet-keys-throw/repro.json b/bugs/datasheet-keys-throw/repro.json index abf651fe0..324f5b414 100644 --- a/bugs/datasheet-keys-throw/repro.json +++ b/bugs/datasheet-keys-throw/repro.json @@ -2,7 +2,7 @@ "mode": "lane", "lane": "addin:datasheet", "tests": [ - "keys: Up and Down move the current record; PageDown scrolls without moving it" + "keys: Home and End throw; after Up or Down, Right, Left, Tab and Shift+Down throw and move nothing" ], - "steps": "1. A datasheet with a few columns and rows. Click a data cell.\n2. Press Right. Nothing moves; the page reports an uncaught TypeError.\n3. Press Home. Nothing moves; the page reports `page left not yet implemented`.\nControl: Down moves the current record by one." + "steps": "1. A datasheet with a few columns and rows. Click a data cell.\n2. Press Home. Nothing moves; the page reports `page left not yet implemented`. End, Ctrl+Home and Ctrl+End do the same.\n3. Click a data cell, then press Down: the current record moves down one.\n4. Press Right. Nothing moves; the page reports an uncaught `TypeError: Cannot read properties of null (reading 'x')`. Left, Tab and Shift+Down do the same, until the next click.\nControl: Right pressed straight after a click moves the current cell one column right." } diff --git a/bugs/datasheet-zero-drawn-blank/repro.json b/bugs/datasheet-zero-drawn-blank/repro.json index 0bdda1021..4f25b3888 100644 --- a/bugs/datasheet-zero-drawn-blank/repro.json +++ b/bugs/datasheet-zero-drawn-blank/repro.json @@ -2,7 +2,7 @@ "mode": "lane", "lane": "addin:datasheet", "tests": [ - "what the grid draws: the header, a 0 as nothing, no number formatting, a tick only for true" + "a 0 draws nothing, in an integer column and in a string column" ], "steps": "1. A datasheet whose `onGetInfo` answers `{\"recordCount\": 2, \"columns\": [{\"name\": \"n\", \"type\": \"integer\"}, {\"name\": \"s\", \"type\": \"string\"}]}`.\n2. Its `onGetRows` answers `[[0, 0], [1, 1]]`.\n3. The first row's two cells are empty; the second row shows `1` and `1`." } diff --git a/bugs/designer-dirty-dot-stays/repro.json b/bugs/designer-dirty-dot-stays/repro.json index 9812e8891..098bc5692 100644 --- a/bugs/designer-dirty-dot-stays/repro.json +++ b/bugs/designer-dirty-dot-stays/repro.json @@ -2,7 +2,8 @@ "mode": "lane", "lane": "addin:designers", "tests": [ - "SetFileData with the saved bytes: the page holds the tab unchanged, but its dot stays" + "SetFileData with the saved bytes: the page holds the tab unchanged, but its dot stays", + "closing a tab the page holds unchanged: no question; OnClosing, OnDeactivated, OnClosed" ], "steps": "1. A designer that calls `SetFileData` with changed bytes: the tab shows the dot.\n2. The designer calls `SetFileData` with the bytes the file was opened with. The dot stays.\n3. Close the tab. The IDE asks nothing, as for a tab with no changes." } diff --git a/bugs/menus-removealladdedentries-noop/repro.json b/bugs/menus-removealladdedentries-noop/repro.json index 301e027a0..d791099bf 100644 --- a/bugs/menus-removealladdedentries-noop/repro.json +++ b/bugs/menus-removealladdedentries-noop/repro.json @@ -2,7 +2,7 @@ "mode": "lane", "lane": "addin:menus", "tests": [ - "Menus.RemoveAllAddedEntries changes nothing; a compiler restart drops every entry, the add-in adds its own again, and the dead ProbeFirst item stays" + "Menus.RemoveAllAddedEntries changes nothing: the entries and the custom menus stay" ], "steps": "1. An add-in that adds an entry to `Host.Menus.FileMenu`, one to `Host.Menus.ProjectExplorerFileViewContextMenu`, and a menu with `Host.Menus.AddCustom`.\n2. Call `Host.Menus.RemoveAllAddedEntries`.\n3. Open the **File** menu, and right-click a file in the Project Explorer. Both entries are still there, and so is the custom menu." } diff --git a/bugs/toolwindow-addin-colours-stale/repro.json b/bugs/toolwindow-addin-colours-stale/repro.json index c250805af..55117bcd4 100644 --- a/bugs/toolwindow-addin-colours-stale/repro.json +++ b/bugs/toolwindow-addin-colours-stale/repro.json @@ -2,7 +2,7 @@ "mode": "lane", "lane": "addin:menus", "tests": [ - "--themeAddin*: a tool window keeps the colours of the theme it was made in; High Contrast Dark has Dark's" + "--themeAddin*: a tool window keeps the values of the theme it was made in" ], "steps": "1. Under the Dark theme, an add-in makes a tool window whose CSS is `body { background: var(--themeAddinBackColor) }`. The background is `#2b2b2b`.\n2. Choose **Window → Theme → Light**. The tool window's background stays `#2b2b2b`; the IDE's own panels turn light.\n3. Control: a tool window made now has Light's `#FFFFFF`." } diff --git a/builder/page-baseline.json b/builder/page-baseline.json index 651fc8805..3ae1ed4fc 100644 --- a/builder/page-baseline.json +++ b/builder/page-baseline.json @@ -1,5 +1,5 @@ { "src": "docs", "pages": 1660, - "staticFiles": 1589 + "staticFiles": 1593 } diff --git a/docs/Documentation/Images/confirm-merge.light.png b/docs/Documentation/Images/confirm-merge.light.png index 61c1ed7a8..0108aa42c 100644 Binary files a/docs/Documentation/Images/confirm-merge.light.png and b/docs/Documentation/Images/confirm-merge.light.png differ diff --git a/docs/Documentation/Images/confirm-merge.png b/docs/Documentation/Images/confirm-merge.png index 8f1114a68..245158b4a 100644 Binary files a/docs/Documentation/Images/confirm-merge.png and b/docs/Documentation/Images/confirm-merge.png differ diff --git a/docs/Documentation/Images/confirm-merge.svg b/docs/Documentation/Images/confirm-merge.svg index d2ff1c292..0c1cbe3a3 100644 --- a/docs/Documentation/Images/confirm-merge.svg +++ b/docs/Documentation/Images/confirm-merge.svg @@ -1 +1 @@ -MergeinfoCommit messageExtended descriptionCommit emailConfirm mergeCancelStill in progress?Convert to draftMerge pull request #263 from contributor/staging3Staging3contributor@users.noreply.github.com6b +MergeinfoCommit messageExtended descriptionCommit emailConfirm mergeCancelStill in progress?Convert to draftMerge pull request #286 from contributor/stagingDocument BETA 1045: tbIDE additions, the bundled add-ins, retaken screenshotscontributor@users.noreply.github.com6b diff --git a/docs/Reference/Built-In/tbIDE/Datasheet.md b/docs/Reference/Built-In/tbIDE/Datasheet.md index 3b255cbc1..0e3ecf823 100644 --- a/docs/Reference/Built-In/tbIDE/Datasheet.md +++ b/docs/Reference/Built-In/tbIDE/Datasheet.md @@ -60,7 +60,11 @@ Three steps make a datasheet, all of them on its **parent** element, not on the Then set what the controller is to show, such as `setZoom` or `setColumnWidths`, and call `controller.loadData()`. The datasheet then asks for the columns through **onGetInfo**, and for the rows on screen through **onGetRows**. Until the columns have come, it shows nothing. -A parent holds one datasheet. Its colours are the theme's [colours for addins](Themes#colours-for-addins), and follow a change of the IDE's theme. Its text is Tahoma, 12 pixels high at 100 percent. +A parent holds one datasheet. Its colours are the theme's [colours for addins](Themes#colours-for-addins), as its parent has them, and in a designer's tab they follow a change of the IDE's theme. Its text is Tahoma, 12 pixels high at 100 percent. + + +> [!NOTE] BETA 1045 +> A datasheet in a [tool window](ToolWindow) keeps the colours of the theme the window was made in, because the window keeps that theme's colours for addins. After a change from Dark to Light it is still drawn in Dark's colours. A tool window made after the change, with an id no window has had, has the new theme's colours. ## Events @@ -183,7 +187,7 @@ Before `loadData()`, a method that sets how the grid looks keeps the value for w | `setColumnIsSorted(index, on)`, `setColumnIsFiltered(index, on)` | Shows or hides the sort mark or the filter mark in the header of a column, by its number from 0. A filter mark also shows *(filtered)* in the bar at the bottom. The datasheet itself neither sorts nor filters: the addin does that in the rows it gives, and calls `refresh()`. | | `getSelectedRows()` | Returns the selected rows as `"first:last"`, both counted from 0 and both included: `"3:5"` for three rows. With no row selected, it returns the current row as `"r:r"`, and `"-1:-1"` when there is none. | | `selectAllRows()` | Selects every row. | -| `navigateToRecord(n)` | Makes row *n* the current row, counted from 1, and scrolls to it. A number past either end goes to the first or the last row. | +| `navigateToRecord(n)` | Makes row *n* the current row, counted from 1, and scrolls to it. A fraction is dropped: 12.7 is row 12. A number past either end goes to the first or the last row. | | `flashMessage(text, ms)` | Shows *text* in the bar at the bottom for *ms* milliseconds, 3,000 by default. An empty text clears it. | | `getState()` | Returns `"created"`, `"loading"`, `"ready"`, `"refreshing"`, `"error"` or `"disposed"`. | | `getLastError()` | Returns the reason for the last failure, or an empty string. | @@ -192,11 +196,11 @@ Before `loadData()`, a method that sets how the grid looks keeps the value for w ## What the user does -The bar at the bottom moves to the first, previous, next and last row, or to the row whose number is typed into its box, and says how many rows there are. Up and Down move the current row, and so does Enter, down. Page Down and Page Up scroll, and leave the current row where it was. The mouse wheel scrolls, with Ctrl held too: it does not zoom. +The bar at the bottom moves to the first, previous, next and last row, or to the row whose number is typed into its box, and says how many rows there are. Up and Down move the current row, and so does Enter, down. Page Down and Page Up scroll, and leave the current row where it was. After a click on a cell, Right, Left and Tab move to the next or previous cell, and Shift+Down moves the current row down. The mouse wheel scrolls, with Ctrl held too: it does not zoom. > [!NOTE] BETA 1045 -> Right, Left, Tab, Home and End move nothing in a datasheet, and each raises an error in the IDE's page. Scroll sideways with the scroll bar. +> Home and End, with or without Ctrl, move nothing in a datasheet, and each raises an error in the IDE's page. Once Up or Down has moved the current row, Right, Left, Tab and Shift+Down do the same, until the next click on a cell. Click a cell first, or scroll sideways with the scroll bar. No cell can be edited: a double-click, or a key typed on a cell, opens no editor. diff --git a/docs/Reference/Built-In/tbIDE/Designer.md b/docs/Reference/Built-In/tbIDE/Designer.md index b5d27720e..985b0b67c 100644 --- a/docs/Reference/Built-In/tbIDE/Designer.md +++ b/docs/Reference/Built-In/tbIDE/Designer.md @@ -55,7 +55,7 @@ The designer keeps the [**DesignerHost**](DesignerHost) it is given, builds its | The project is saved, or the tab with Ctrl+S | [**OnSaveCompleted**](#onsavecompleted). | | A tab with no changes is closed | [**OnClosing**](#onclosing), **OnDeactivated**, [**OnClosed**](#onclosed). | | A tab with changes is closed, and the user answers **Discard Changes** | **OnClosing**, **OnDeactivated**, **OnClosed**. The file keeps the bytes it was saved with. | -| A tab with changes is closed, and the user answers **Save** | **OnDeactivated**, **OnClosed**, then **OnSaveCompleted**. There is no **OnClosing**. | +| A tab with changes is closed, and the user answers **Save** | **OnDeactivated**, **OnClosed**, then **OnSaveCompleted**. There is no **OnClosing**. The bytes go into the project the IDE holds, and reach the disk at the next save of the project. | | The compiler restarts | The designer is gone with the compiler. The addin is loaded again, and for each tab of its designers the IDE calls **CreateDesigner**, **OnAttached** and **OnFileDataChanged**, with the tab's bytes, the changes not saved yet included. There is no **OnActivated**, though the tab may be the active one. | **OnActivated** comes before the first **OnFileDataChanged**, so a designer has to be ready for it with no data yet. @@ -113,7 +113,7 @@ Syntax: *designer*.**OnFileDataChanged**( *byteData* ) ### OnSaveCompleted {: .no_toc } -The file has been written with the bytes the designer gave last. A designer that marks its changes can clear the marks here. +The IDE has taken the bytes the designer gave last as the file's saved contents. After Ctrl+S or a save of the project, the file on disk holds them. After a changed tab is closed with **Save**, the project the IDE holds has them, and the disk has them at the next save of the project. A designer that marks its changes can clear the marks here. Syntax: *designer*.**OnSaveCompleted**() diff --git a/docs/Reference/Built-In/tbIDE/DesignerHost.md b/docs/Reference/Built-In/tbIDE/DesignerHost.md index 38f08f750..6cf963011 100644 --- a/docs/Reference/Built-In/tbIDE/DesignerHost.md +++ b/docs/Reference/Built-In/tbIDE/DesignerHost.md @@ -87,7 +87,7 @@ Syntax: *host*.**SetFileData** *bytes* *bytes* : *required* The whole file. **Byte()**, passed **ByRef**. For an empty file, Sample 24 passes an array with no elements, made with `SafeArrayCreateVector`, rather than an erased one, which its comments say the IDE does not take. -The IDE keeps the bytes as the tab's contents, and the tab is marked as changed. The file on disk changes only when the project or the tab is saved; then the designer's [**OnSaveCompleted**](Designer#onsavecompleted) runs. **SetFileData** calls no [**OnFileDataChanged**](Designer#onfiledatachanged). +The IDE keeps the bytes as the tab's contents, and the tab is marked as changed. The file on disk changes only when the project is saved, which Ctrl+S in the tab also does. Saving the tab, or closing it with **Save**, runs the designer's [**OnSaveCompleted**](Designer#onsavecompleted); closing it with **Save** puts the bytes into the project the IDE holds, not on the disk. **SetFileData** calls no [**OnFileDataChanged**](Designer#onfiledatachanged). Call it at each change, as Samples 24, 25 and 27 do, so that a save writes what the user sees and a restart of the compiler gives the designer its unsaved bytes back. diff --git a/docs/Reference/Built-In/tbIDE/Images/Restart_Without_Addins.light.png b/docs/Reference/Built-In/tbIDE/Images/Restart_Without_Addins.light.png new file mode 100644 index 000000000..93da68254 Binary files /dev/null and b/docs/Reference/Built-In/tbIDE/Images/Restart_Without_Addins.light.png differ diff --git a/docs/Reference/Built-In/tbIDE/Images/Restart_Without_Addins.light.svg b/docs/Reference/Built-In/tbIDE/Images/Restart_Without_Addins.light.svg new file mode 100644 index 000000000..c0873ba1e --- /dev/null +++ b/docs/Reference/Built-In/tbIDE/Images/Restart_Without_Addins.light.svg @@ -0,0 +1 @@ +FileEditViewProjectFormatDebugRunToolsAdd-InsWindowHelpproject.twinproj - twinBASIC (twinBASIC IDE BETA 1045)win32TOOLBOXEDITOR 1DEBUG CONSOLE16:41:58.204restarting from MEMORY [C:\tbshots\TbIde\project.twinproj]+ Shift diff --git a/docs/Reference/Built-In/tbIDE/Images/Restart_Without_Addins.png b/docs/Reference/Built-In/tbIDE/Images/Restart_Without_Addins.png new file mode 100644 index 000000000..62561e828 Binary files /dev/null and b/docs/Reference/Built-In/tbIDE/Images/Restart_Without_Addins.png differ diff --git a/docs/Reference/Built-In/tbIDE/Images/Restart_Without_Addins.svg b/docs/Reference/Built-In/tbIDE/Images/Restart_Without_Addins.svg new file mode 100644 index 000000000..64f798faf --- /dev/null +++ b/docs/Reference/Built-In/tbIDE/Images/Restart_Without_Addins.svg @@ -0,0 +1 @@ +FileEditViewProjectFormatDebugRunToolsAdd-InsWindowHelpproject.twinproj - twinBASIC (twinBASIC IDE BETA 1045)win32TOOLBOXEDITOR 1DEBUG CONSOLE16:41:58.204restarting from MEMORY [C:\tbshots\TbIde\project.twinproj]+ Shift diff --git a/docs/Reference/Built-In/tbIDE/Themes.md b/docs/Reference/Built-In/tbIDE/Themes.md index 9de8e4e9a..959af822c 100644 --- a/docs/Reference/Built-In/tbIDE/Themes.md +++ b/docs/Reference/Built-In/tbIDE/Themes.md @@ -59,9 +59,9 @@ myToolWindow.ApplyCss _ Give each `var()` a second value, as here, for an IDE whose theme does not set the colour. - + > [!NOTE] BETA 1045 -> A [**ToolWindow**](ToolWindow) keeps the colours of the theme it was made in: after the user chooses another theme, its variables still hold the old values. A tool window made after the change has the new ones. For a tool window that follows the theme, set its colours in [**Host.OnChangedTheme**](Host#onchangedtheme), as the example at the top of this page does. +> A [**ToolWindow**](ToolWindow) keeps the colours of the theme it was made in: after the user chooses another theme, its variables still hold the old values, and what is drawn with them, a [**datasheet**](Datasheet) included, keeps the old colours. A tool window made after the change, with an id no window has had, has the new ones. For elements of a tool window that follow the theme, set their colours in [**Host.OnChangedTheme**](Host#onchangedtheme), as the example at the top of this page does, rather than through the variables. | Variable | For | Dark | Light | |---|---|---|---| diff --git a/docs/Reference/Built-In/tbIDE/index.md b/docs/Reference/Built-In/tbIDE/index.md index d940cd9c9..e00e36a55 100644 --- a/docs/Reference/Built-In/tbIDE/index.md +++ b/docs/Reference/Built-In/tbIDE/index.md @@ -75,7 +75,18 @@ The build path above writes the DLL into the IDE's own `addins` folder, and the [LINKER] FAILED to create output file '...\addins\win32\MyAddIn.dll' (error code 32) ``` -and then names the process that holds the file, the IDE's own compiler, `twinBASIC_win32_noDEP.exe`. Error code 32 is Windows' *file in use*. To change an addin and build it again, build it somewhere else and copy it in while the IDE is closed: +and then names the process that holds the file, the IDE's own compiler, `twinBASIC_win32_noDEP.exe`. Error code 32 is Windows' *file in use*. The same happens in the per-user `addins` folder under `%APPDATA%`. + +The easiest way to build the addin again is to build it into the per-user folder, and to restart the compiler without its addins for the build: + +1. Set the addin project's [Build Output Path](../../IDE/Project-Settings#build-output-path) to `${AppData}\twinBASIC\addins\${Architecture}\${ProjectName}.${FileExtension}`, the path samples 24 to 27 use. If an earlier build is in the installation's `addins` folder, delete it there while the IDE is closed. +2. Hold Shift while you [restart the compiler](../../IDE/Building/Build-Configuration#restart-the-compiler), with the toolbar button or **Tools → Restart the compiler**. The DEBUG CONSOLE says `[IDE] SHIFT KEY DETECTED: DISABLED LOADING OF ADDINS`, and the new compiler does not load the addin, so nothing holds the DLL. See [Opening projects](../../IDE/Starting/Opening-Projects#what-happens-as-a-project-loads) for what else a load with Shift held skips. +3. Build. The new DLL replaces the old one. +4. Restart the compiler again, without Shift. It loads the new build. + +![The toolbar's build target box, win32, and the Restart the compiler button after it, ringed, with the label + Shift under the button. An arrow leads to the DEBUG CONSOLE, at its second line, [IDE] SHIFT KEY DETECTED: DISABLED LOADING OF ADDINS, under the line restarting from MEMORY and the project's path.](Images/Restart_Without_Addins.png){:width="795" height="158"} + +Alternatively, build the addin somewhere else and copy it in while the IDE is closed: 1. Set the addin project's [Build Output Path](../../IDE/Project-Settings#build-output-path) to `${SourcePath}\Build\${ProjectName}_${Architecture}.${FileExtension}`, the path the other project templates use. 2. Build. The DLL goes into a `Build` folder beside the `.twinproj`, as `MyAddIn_win32.dll`. diff --git a/docs/Reference/Contributed/VBA_JSON/Dictionary/Item.md b/docs/Reference/Contributed/VBA_JSON/Dictionary/Item.md index b7d032965..56d62aff4 100644 --- a/docs/Reference/Contributed/VBA_JSON/Dictionary/Item.md +++ b/docs/Reference/Contributed/VBA_JSON/Dictionary/Item.md @@ -9,9 +9,9 @@ has_toc: false Returns or sets the value stored under a given key in the **Dictionary**. - -> [!WARNING] 2.3.1.1 -> Keys are compared without regard to case, so `d("a")` and `d("A")` are one entry: the second assignment replaces the first value. **ParseJson** therefore merges the keys `id` and `ID` of one JSON object into one entry that holds the last value, and the other value is lost without an error. JSON keys are case-sensitive, and so are the keys of the **Scripting.Dictionary** that VBA-JSON uses on Windows. + +Keys are compared with regard to case, so `d("a")` and `d("A")` are two entries. + ## Get @@ -32,7 +32,7 @@ If *Key* does not exist in the dictionary, the underlying **Collection** raises -> [!NOTE] 2.3.1.1 +> [!NOTE] 2.3.2.1 > Reading a key that is not there raises run-time error 5 and adds nothing. A **Scripting.Dictionary** returns **Empty** and adds the key. ## Let @@ -52,7 +52,7 @@ If *Key* already exists, the previous entry is removed before the new value is a -> [!NOTE] 2.3.1.1 +> [!NOTE] 2.3.2.1 > Assigning to an existing key moves the entry to the end of the **For Each** and **Keys** order. A **Scripting.Dictionary** keeps the entry where it was, so code that writes a value back into a parsed object changes the order of the keys that **ConvertToJson** writes. ## Set diff --git a/docs/Reference/Contributed/VBA_JSON/Dictionary/Keys.md b/docs/Reference/Contributed/VBA_JSON/Dictionary/Keys.md index a7dd7f8ec..37f903c97 100644 --- a/docs/Reference/Contributed/VBA_JSON/Dictionary/Keys.md +++ b/docs/Reference/Contributed/VBA_JSON/Dictionary/Keys.md @@ -19,7 +19,7 @@ The property returns a **Variant** containing an array of **String** values, one -> [!NOTE] 2.3.1.1 +> [!NOTE] 2.3.2.1 > Assigning to an existing key moves the entry to the end of the order. A **Scripting.Dictionary** keeps the entry where it was. ### Example diff --git a/docs/Reference/Contributed/VBA_JSON/Dictionary/index.md b/docs/Reference/Contributed/VBA_JSON/Dictionary/index.md index aed217fba..39a804358 100644 --- a/docs/Reference/Contributed/VBA_JSON/Dictionary/index.md +++ b/docs/Reference/Contributed/VBA_JSON/Dictionary/index.md @@ -10,8 +10,8 @@ has_toc: false A string-keyed collection that maps **String** keys to **Variant** values, backed by a twinBASIC **Collection**. - -**Dictionary** is the object type returned by the JSON parser when a JSON object is decoded. Keys are strings, compared as the backing **Collection** compares its keys: without regard to case. Values can be any **Variant**---numbers, strings, **Boolean**, **Null** (for JSON `null`), or nested **Dictionary** and **Collection** objects (a JSON array becomes a **Collection**). + +**Dictionary** is the object type returned by the JSON parser when a JSON object is decoded. Keys are strings, compared with regard to case, as JSON keys are: `d("a")` and `d("A")` are two entries. Values can be any **Variant**---numbers, strings, **Boolean**, **Null** (for JSON `null`), or nested **Dictionary** and **Collection** objects (a JSON array becomes a **Collection**). ```tb check_build Dim d As New Dictionary @@ -24,13 +24,18 @@ Debug.Print d("age") ' 30 ``` - -> [!WARNING] 2.3.1.1 -> Keys are compared without regard to case, so `d("a")` and `d("A")` are one entry: the second assignment replaces the first value. **ParseJson** therefore merges the keys `id` and `ID` of one JSON object into one entry that holds the last value, and the other value is lost without an error. JSON keys are case-sensitive, and so are the keys of the **Scripting.Dictionary** that VBA-JSON uses on Windows. - * TOC {:toc} +## Constructors + +### New +{: .no_toc } + +Creates an empty **Dictionary**, and sets its backing **Collection** to compare keys with regard to case. + +Syntax: **New Dictionary** + ## Properties ### Item @@ -118,15 +123,15 @@ Assigning to an existing key replaces the current value: **Item Let/Set** remove -> [!NOTE] 2.3.1.1 +> [!NOTE] 2.3.2.1 > Reading a key that is not there raises run-time error 5 and adds nothing. A **Scripting.Dictionary** returns **Empty** and adds the key. -> [!NOTE] 2.3.1.1 +> [!NOTE] 2.3.2.1 > Assigning to an existing key moves the entry to the end of the **For Each** and **Keys** order. A **Scripting.Dictionary** keeps the entry where it was, so code that writes a value back into a parsed object changes the order of the keys that **ConvertToJson** writes. -> [!NOTE] 2.3.1.1 +> [!NOTE] 2.3.2.1 > **Dictionary** has only the **Item** and **Keys** members. The other members of **Scripting.Dictionary**---**Count**, **Exists**, **Add**, **Remove**, **RemoveAll**, **Items**, **Key** and **CompareMode**---do not exist, and code that uses one does not compile. diff --git a/docs/Reference/Contributed/VBA_JSON/JsonConverter/ConvertToIso.md b/docs/Reference/Contributed/VBA_JSON/JsonConverter/ConvertToIso.md index c73bc61e0..f54dcecbf 100644 --- a/docs/Reference/Contributed/VBA_JSON/JsonConverter/ConvertToIso.md +++ b/docs/Reference/Contributed/VBA_JSON/JsonConverter/ConvertToIso.md @@ -25,7 +25,7 @@ Returns a **String** in the form `yyyy-mm-ddTHH:mm:ss.000Z` representing the equ -> [!WARNING] 2.3.1.1 +> [!WARNING] 2.3.2.1 > A **Date** before 30 December 1899 gets the wrong day and time, and one before 1 January 1601 gives a meaningless date, with no error: [**ConvertToUtc**](ConvertToUtc) cannot convert it. Run-time error 10014 is not raised for it, and neither is it by [**ConvertToJson**](ConvertToJson) for such a **Date**. diff --git a/docs/Reference/Contributed/VBA_JSON/JsonConverter/ConvertToJson.md b/docs/Reference/Contributed/VBA_JSON/JsonConverter/ConvertToJson.md index e7c52638c..f2dfb6a0d 100644 --- a/docs/Reference/Contributed/VBA_JSON/JsonConverter/ConvertToJson.md +++ b/docs/Reference/Contributed/VBA_JSON/JsonConverter/ConvertToJson.md @@ -41,23 +41,23 @@ The following table summarises how each VBA type maps to JSON: -> [!WARNING] 2.3.1.1 +> [!WARNING] 2.3.2.1 > The keys of a **Dictionary** are written without escapes. A key that holds a quote, a backslash or a control character gives text that is not valid JSON (the key `a"b` is written as `"a"b"`), and a program that reads it fails or reads a different key. -> [!WARNING] 2.3.1.1 +> [!WARNING] 2.3.2.1 > The rule for a large-number **String** looks only at the characters, so a string of 16 to 100 digits, periods, `E` and `e` is written without quotes even when it is not a JSON number. `"0000123456789012"` (leading zeros), 16 letters `E` and 16 periods all give text that is not valid JSON. -> [!WARNING] 2.3.1.1 +> [!WARNING] 2.3.2.1 > An array whose lower bound is below zero is not written correctly, and no error is raised. An array from -1 to 1 gives `[]`, and an array of two dimensions whose second dimension starts below zero gives `[null,null]`. -> [!WARNING] 2.3.1.1 +> [!WARNING] 2.3.2.1 > A **Date** before 30 December 1899 is written as a wrong time, and one before 1 January 1601 as a meaningless date, with no error. See [**ConvertToIso**](ConvertToIso). -> [!NOTE] 2.3.1.1 +> [!NOTE] 2.3.2.1 > A **Double** is written with at most 15 significant digits, as **CStr** gives it: 1 / 3 gives `0.333333333333333` and 0.1 + 0.2 gives `0.3`. Reading the text back gives a **Double** that can differ from the original in the last digits. diff --git a/docs/Reference/Contributed/VBA_JSON/JsonConverter/ConvertToUtc.md b/docs/Reference/Contributed/VBA_JSON/JsonConverter/ConvertToUtc.md index 42765992b..9db2497f6 100644 --- a/docs/Reference/Contributed/VBA_JSON/JsonConverter/ConvertToUtc.md +++ b/docs/Reference/Contributed/VBA_JSON/JsonConverter/ConvertToUtc.md @@ -23,7 +23,7 @@ On Windows, **ConvertToUtc** calls the Win32 `GetTimeZoneInformation` and `TzSpe -> [!WARNING] 2.3.1.1 +> [!WARNING] 2.3.2.1 > A **Date** before 30 December 1899 gets the wrong day and time, and one before 1 January 1601 gives a meaningless date, with no error: Windows cannot convert it, and the function returns a date that bears no relation to the argument. Run-time error 10012 is not raised for it. diff --git a/docs/Reference/Contributed/VBA_JSON/JsonConverter/ParseIso.md b/docs/Reference/Contributed/VBA_JSON/JsonConverter/ParseIso.md index 89d35bb1e..cc2708000 100644 --- a/docs/Reference/Contributed/VBA_JSON/JsonConverter/ParseIso.md +++ b/docs/Reference/Contributed/VBA_JSON/JsonConverter/ParseIso.md @@ -38,11 +38,11 @@ On parse failure the function raises run-time error 10013 with the source `"UtcC -> [!WARNING] 2.3.1.1 +> [!WARNING] 2.3.2.1 > An offset written without a colon, such as `+0530`, is read as a number of hours: `+0530` is 530 hours, and `2024-06-03T14:30:00+0530` gives 12 May 2024, with no error. Write the offset as `+05:30`. -> [!WARNING] 2.3.1.1 +> [!WARNING] 2.3.2.1 > A string with a time on a date before 30 December 1899 gives the wrong day and time, and one before 1 January 1601 gives a meaningless date, with no error: [**ParseUtc**](ParseUtc) cannot convert it. ### Example diff --git a/docs/Reference/Contributed/VBA_JSON/JsonConverter/ParseJson.md b/docs/Reference/Contributed/VBA_JSON/JsonConverter/ParseJson.md index 31ddba08f..6b8a7fcfa 100644 --- a/docs/Reference/Contributed/VBA_JSON/JsonConverter/ParseJson.md +++ b/docs/Reference/Contributed/VBA_JSON/JsonConverter/ParseJson.md @@ -25,29 +25,29 @@ All carriage returns, line feeds, and tab characters are removed from *JsonStrin ### Remarks -> [!WARNING] 2.3.1.1 +> [!WARNING] 2.3.2.1 > The escape `\n` is read as a carriage return followed by a line feed, two characters, and not as the one line feed that JSON defines. The text `"a\nb"` gives `"a" & vbCr & vbLf & "b"`, and a text read and written again with **ConvertToJson** changes from `\n` to `\r\n`. -> [!WARNING] 2.3.1.1 +> [!WARNING] 2.3.2.1 > Text that ends before an array is closed, such as `[1,2` or `["abc`, does not return: the parser keeps adding empty items to the array. An object that is not closed raises error 10001, but an unclosed array inside an object hangs the same way. - -> [!WARNING] 2.3.1.1 -> Keys that differ only in case, such as `id` and `ID` in one JSON object, become one entry of the **Dictionary**, which holds the last value; the other value is lost without an error. - -> [!NOTE] 2.3.1.1 +> [!NOTE] 2.3.2.1 > A number outside the range of a **Double**, such as `1e999`, raises run-time error 6 (Overflow) and not error 10001. If *JsonString* does not begin with `{` or `[` after leading spaces are skipped, **ParseJson** raises run-time error **10001** with source `JSONConverter` and a message that shows a short excerpt of the surrounding text with a caret under the position of the unexpected character. The excerpt holds up to ten characters on each side of the position. The same error is raised when the parser meets other text it cannot read inside the document, such as an unquoted key, a missing colon, a trailing comma or a value it does not know. - -The parser does not check for commas between items, and it ignores any text after the top-level value. It also accepts text that JSON does not allow: strings and keys in single quotes, a number with a leading zero or a leading plus sign or ending in a period, and an escape it does not know, which it reads as the character after the backslash. A `\u` followed by four characters that are not hexadecimal digits is read as the character U+0000. A key that appears twice keeps its last value, at the end of the order of the keys. The empty string is a key like any other. + +The parser does not check for commas between items, and it ignores any text after the top-level value. It also accepts text that JSON does not allow: strings and keys in single quotes, a number with a leading zero or a leading plus sign or ending in a period, and an escape it does not know, which it reads as the character after the backslash. A `\u` followed by four characters that are not hexadecimal digits is read as the character U+0000. A key that appears twice keeps its last value, at the end of the order of the keys. Keys that differ only in case, such as `id` and `ID`, are separate entries. + +> [!WARNING] BETA 1045 +> An entry whose key is the empty string, as in `{"":1}`, is lost: the **Dictionary** that **ParseJson** returns does not list the key in **Keys**, and reading it raises run-time error 5. The cause is a defect of twinBASIC's **Collection**, which the **Dictionary** keeps its entries in. + Large numbers in JSON (a number whose text is 16 or more characters long; 17 or more when it contains a decimal point) are returned as **String** by default to avoid the 15-significant-digit limit of **Double**. Set `JsonConverter.JsonOptions.UseDoubleForLargeNumbers = True` to force all numbers to **Double** regardless of length. diff --git a/docs/Reference/Contributed/VBA_JSON/JsonConverter/ParseUtc.md b/docs/Reference/Contributed/VBA_JSON/JsonConverter/ParseUtc.md index 55ea5e256..99dc7ff08 100644 --- a/docs/Reference/Contributed/VBA_JSON/JsonConverter/ParseUtc.md +++ b/docs/Reference/Contributed/VBA_JSON/JsonConverter/ParseUtc.md @@ -23,7 +23,7 @@ On Windows, **ParseUtc** calls the Win32 `GetTimeZoneInformation` and `SystemTim -> [!WARNING] 2.3.1.1 +> [!WARNING] 2.3.2.1 > A **Date** before 30 December 1899 gets the wrong day and time, and one before 1 January 1601 gives a meaningless date, with no error: Windows cannot convert it, and the function returns a date that bears no relation to the argument. Run-time error 10011 is not raised for it. diff --git a/docs/Reference/Contributed/VBA_JSON/JsonConverter/index.md b/docs/Reference/Contributed/VBA_JSON/JsonConverter/index.md index b6b129ded..1bbe4e77f 100644 --- a/docs/Reference/Contributed/VBA_JSON/JsonConverter/index.md +++ b/docs/Reference/Contributed/VBA_JSON/JsonConverter/index.md @@ -75,29 +75,29 @@ All carriage returns, line feeds, and tab characters are removed from *JsonStrin -> [!WARNING] 2.3.1.1 +> [!WARNING] 2.3.2.1 > The escape `\n` is read as a carriage return followed by a line feed, two characters, and not as the one line feed that JSON defines. The text `"a\nb"` gives `"a" & vbCr & vbLf & "b"`, and a text read and written again with **ConvertToJson** changes from `\n` to `\r\n`. -> [!WARNING] 2.3.1.1 +> [!WARNING] 2.3.2.1 > Text that ends before an array is closed, such as `[1,2` or `["abc`, does not return: the parser keeps adding empty items to the array. An object that is not closed raises error 10001, but an unclosed array inside an object hangs the same way. - -> [!WARNING] 2.3.1.1 -> Keys that differ only in case, such as `id` and `ID` in one JSON object, become one entry of the **Dictionary**, which holds the last value; the other value is lost without an error. - -> [!NOTE] 2.3.1.1 +> [!NOTE] 2.3.2.1 > A number outside the range of a **Double**, such as `1e999`, raises run-time error 6 (Overflow) and not error 10001. Raises run-time error 10001 with the source `"JSONConverter"` and a diagnostic message that shows the text around the error, with a caret marking the position, if the parser meets text it cannot read, such as a top-level value that is not an object or array, an unquoted key, a missing colon, a trailing comma or an unrecognised value. - -The parser is lenient: it does not check for commas between items, and it ignores any text after the top-level value. It also accepts strings and keys in single quotes, a number with a leading zero or a leading plus sign or ending in a period, and an escape it does not know, which it reads as the character after the backslash. A key that appears twice keeps its last value. + +The parser is lenient: it does not check for commas between items, and it ignores any text after the top-level value. It also accepts strings and keys in single quotes, a number with a leading zero or a leading plus sign or ending in a period, and an escape it does not know, which it reads as the character after the backslash. A key that appears twice keeps its last value. Keys that differ only in case, such as `id` and `ID`, are separate entries. + +> [!WARNING] BETA 1045 +> An entry whose key is the empty string, as in `{"":1}`, is lost: the **Dictionary** that **ParseJson** returns does not list the key in **Keys**, and reading it raises run-time error 5. The cause is a defect of twinBASIC's **Collection**, which the **Dictionary** keeps its entries in. + ### ConvertToJson Serializes a value to a JSON string. @@ -117,23 +117,23 @@ Returns a **String** containing the JSON representation of *JsonValue*. -> [!WARNING] 2.3.1.1 +> [!WARNING] 2.3.2.1 > The keys of a **Dictionary** are written without escapes. A key that holds a quote, a backslash or a control character gives text that is not valid JSON (the key `a"b` is written as `"a"b"`), and a program that reads it fails or reads a different key. -> [!WARNING] 2.3.1.1 +> [!WARNING] 2.3.2.1 > The rule for a large-number **String** looks only at the characters, so a string of 16 to 100 digits, periods, `E` and `e` is written without quotes even when it is not a JSON number. `"0000123456789012"` (leading zeros), 16 letters `E` and 16 periods all give text that is not valid JSON. -> [!WARNING] 2.3.1.1 +> [!WARNING] 2.3.2.1 > An array whose lower bound is below zero is not written correctly, and no error is raised. An array from -1 to 1 gives `[]`, and an array of two dimensions whose second dimension starts below zero gives `[null,null]`. -> [!WARNING] 2.3.1.1 +> [!WARNING] 2.3.2.1 > A **Date** before 30 December 1899 is written as a wrong time, and one before 1 January 1601 as a meaningless date, with no error. See [**ConvertToIso**](ConvertToIso). -> [!NOTE] 2.3.1.1 +> [!NOTE] 2.3.2.1 > A **Double** is written with at most 15 significant digits, as **CStr** gives it: 1 / 3 gives `0.333333333333333` and 0.1 + 0.2 gives `0.3`. Reading the text back gives a **Double** that can differ from the original in the last digits. ### ParseUtc diff --git a/docs/Reference/Contributed/VBA_JSON/index.md b/docs/Reference/Contributed/VBA_JSON/index.md index 7b8790572..b1e2e376b 100644 --- a/docs/Reference/Contributed/VBA_JSON/index.md +++ b/docs/Reference/Contributed/VBA_JSON/index.md @@ -2,20 +2,21 @@ title: VBA_JSON Package parent: Contributed Packages has_toc: false -indexed_from: 2.3.1.1 +indexed_from: 2.3.2.1 permalink: /tB/Packages/Contributed/VBA_JSON/ --- # VBA_JSON Package {: .no_toc } -**Author:** Tim Hall, published on TWINSERV by WaynePhillipsEA. **Version:** 2.3.1.1. **On GitHub:** [VBA-tools/VBA-JSON](https://github.com/VBA-tools/VBA-JSON) and [VBA-tools/VBA-UTC](https://github.com/VBA-tools/VBA-UTC), the VBA libraries the package is made from. +**Author:** Tim Hall, published on TWINSERV by WaynePhillipsEA. **Version:** 2.3.2.1. **On GitHub:** [VBA-tools/VBA-JSON](https://github.com/VBA-tools/VBA-JSON) and [VBA-tools/VBA-UTC](https://github.com/VBA-tools/VBA-UTC), the VBA libraries the package is made from. The **VBA_JSON** contributed package provides JSON parsing and serialization for VBA and twinBASIC projects, along with UTC and ISO 8601 date-conversion utilities. The package exposes a **JsonConverter** standard module containing the primary **ParseJson** and **ConvertToJson** functions, and a **Dictionary** class used to represent JSON objects in memory. ## Classes - [Dictionary](Dictionary/) -- a string-keyed collection that maps String keys to Variant values, returned by ParseJson for JSON objects + - [New](Dictionary/#new) -- creates an empty dictionary whose keys are compared with regard to case - [Item](Dictionary/Item) -- returns or sets the value stored under a given key (default member) - [Keys](Dictionary/Keys) -- returns all keys stored in the dictionary as a Variant array diff --git a/docs/Reference/Contributed/tbFileSysTools/File.md b/docs/Reference/Contributed/tbFileSysTools/File.md index 61d5a98ae..4a1960d4d 100644 --- a/docs/Reference/Contributed/tbFileSysTools/File.md +++ b/docs/Reference/Contributed/tbFileSysTools/File.md @@ -324,7 +324,7 @@ Syntax: *object*.**OpenAsTextStream** ( [ *ioMode* [, *encoding* [, *writeModeLi Returns a [**TextStream**](TextStream); the rules are those of [**OpenTextFile**](FileSystemTools#opentextfile) with *create* **False**. -> [!WARNING] 1.9.0.0 +> [!WARNING] 2.0.0.0 > **ForWriting** empties the file when the stream is opened. Use **ForAppending** to add to it. ### Refresh @@ -362,8 +362,7 @@ Syntax: *object*.**SetAttribute** ( *attr*, *state* ) : *required* A **Boolean**. **True** sets the attribute and **False** clears it. The other attributes stay as they are. -> [!WARNING] 1.9.0.0 -> **SetAttribute** sets nothing, and raises no error, on a file that has no attribute at all, because [**Attributes**](#attributes) then reports **faNormal**, and **faNormal** wins over the attribute being set. A new file has the archive attribute, so it is a file from which the program cleared every attribute that this applies to. To give such a file an attribute, assign [**Attributes**](#attributes). The same method of a [**Folder**](Folder#setattribute) is not affected. +A file with no attribute at all, whose [**Attributes**](#attributes) is **faNormal**, gets the one attribute that is set. Clearing the last attribute of a file leaves **faNormal**. ```tb check_build check_run Dim work As String, f As File @@ -378,13 +377,12 @@ Debug.Print f.Attributes ' 34 f.SetAttribute faHidden, False f.SetAttribute faArchive, False Debug.Print f.Attributes ' 128 -f.SetAttribute faHidden, True ' sets nothing -Debug.Print f.Attributes ' 128 -f.Attributes = faHidden ' this works +f.SetAttribute faHidden, True Debug.Print f.Attributes ' 2 DeleteFolder work, True ``` + ### ToStream {: .no_toc } diff --git a/docs/Reference/Contributed/tbFileSysTools/FileSystemTools.md b/docs/Reference/Contributed/tbFileSysTools/FileSystemTools.md index 5b41748de..5a6106aa8 100644 --- a/docs/Reference/Contributed/tbFileSysTools/FileSystemTools.md +++ b/docs/Reference/Contributed/tbFileSysTools/FileSystemTools.md @@ -52,7 +52,7 @@ These rules apply to every procedure on the page. Each entry states only what de - A path longer than 260 characters works in most procedures, among them [**CreateFolder**](#createfolder), [**FileExists**](#fileexists), [**StringToTextFile**](#stringtotextfile), [**TextFileToString**](#textfiletostring), [**CopyFile**](#copyfile), [**MoveFile**](#movefile), [**Rename**](#rename), [**DeleteFile**](#deletefile), [**DeleteFolder**](#deletefolder), [**GetFile**](#getfile) and [**GetFilePaths**](#getfilepaths). The Scripting Runtime does not accept such a path: its **FileExists** and **FolderExists** return **False** for it, **GetFile** raises error 53 and **OpenTextFile** raises error 76. -> [!NOTE] 1.9.0.0 +> [!NOTE] 2.0.0.0 > These stop at the limit. [**GetFileVersion**](#getfileversion) returns an empty string, and [**File.ShortPath**](File#shortpath) returns the path as it is. [**SetCurrentDir**](#setcurrentdir) raises error 75. A path with a wildcard in it is not found: [**DeleteFile**](#deletefile) and [**CopyFile**](#copyfile) raise error 53 for `deep\*.dll`, where `deep` is a folder with a long path. [**Folder.Files**](Folder#files), [**Folder.SubFolders**](Folder#subfolders) and [**Folder.Size**](Folder#size) raise error 76 for a folder whose own path has 258 characters or more (see the note under [**Folder.Files**](Folder#files)), and [**GetRelativePath**](#getrelativepath) can return a wrong path (see its warning). ```tb check_build check_run @@ -347,15 +347,15 @@ Syntax: **GetRelativePath** ( *basePath*, *targetPath* [, *basePathIsFolder* [, : *optional* A **Boolean**. **True** (default) treats *basePath* as a folder. **False** treats it as a file when it exists as one, and the relative path starts from the folder that holds it. A *basePath* that does not exist is treated as a file when this is **False**. *trimLeadingDotSlash* -: *optional* A **Boolean**. Windows starts a path that goes down with `.\`. **True** (default) removes it, so the result is `src` and not `.\src`. **False** keeps it. +: *optional* A **Boolean**. A result that goes down, or that is the base itself, starts with `.\`. **True** (default) removes it, so the result is `src` and not `.\src`, and `.` and not `.\`. **False** keeps it. A result that goes up, such as `..\Lib`, has no `.\` either way. -Both paths are first made absolute with [**GetAbsolutePathName**](#getabsolutepathname). A *targetPath* that exists as a folder is treated as one; any other, one that does not exist included, is treated as a file. So `GetRelativePath("C:\a", "C:\a")` returns `..\a` when the folder `C:\a` does not exist. +Both paths are first made absolute with [**GetAbsolutePathName**](#getabsolutepathname). The relative path is then worked out from the names in the two paths, compared without regard to letter case, and neither path has to exist. Whether *targetPath* is a file or a folder makes no difference, so `GetRelativePath("C:\a", "C:\a")` returns `.`. -Returns the absolute *targetPath* when there is no relative path, for example when the two paths are on different drives, and when only *targetPath* is longer than 260 characters. +Returns the absolute *targetPath* when there is no relative path: when the two paths are on different drives, or on different network shares. -> [!WARNING] 1.9.0.0 -> When *basePath* is 259 characters or longer, the result can be a relative path that leads to the wrong place, and no error is raised. For a target `x\y.txt` below such a base, the result starts with `..\` and the last name of the base, instead of being `x\y.txt`. A base path of 258 characters or fewer gives the right result. +Paths longer than 260 characters give the same result as short ones. + ```tb check_build check_run Debug.Print GetRelativePath("C:\Projects\App", "C:\Projects\Lib\core.txt") ' ..\Lib\core.txt @@ -369,7 +369,7 @@ Dim shortBase As String, longBase As String shortBase = "C:\" & String$(100, "a") longBase = "C:\" & String$(130, "a") & "\" & String$(130, "b") Debug.Print GetRelativePath(shortBase, shortBase & "\x\y.txt") ' x\y.txt -Debug.Print GetRelativePath(longBase, longBase & "\x\y.txt") = "x\y.txt" ' False +Debug.Print GetRelativePath(longBase, longBase & "\x\y.txt") ' x\y.txt ``` ### GetTempName @@ -526,8 +526,7 @@ Errors: - 58 when a folder, or a file, with that path exists. - 76 when the parent does not exist and *createIntermediates* is **False**. -- 52 when the last component holds a character that is not allowed in a name, the wildcards `*` and `?` among them. -- 75 when the last component is the reserved device name `con` (the message ends with the Windows code 87), and 76 when it is `nul`. +- 52 when the last component holds a character that is not allowed in a name, the wildcards `*` and `?` among them, or is a reserved device name such as `con` or `nul`. ```tb check_build check_run Dim work As String @@ -682,15 +681,15 @@ A file is never replaced: when the destination file exists, error 58 is raised. Moving a file onto itself does nothing and returns its path, except that error 70 is raised when the file is in use. A change of letter case alone is also a move onto itself, so it changes nothing; use [**Rename**](#rename) for it. -Errors: 53 when a wildcard matches no file, or matches only folders; 76 when the destination folder of a wildcard move does not exist; 58 when the destination file exists; 52 when the name of the destination holds a character that Windows does not allow; 75 when it is the reserved device name `con` (the message ends with the Windows code 87). +Errors: 53 when a wildcard matches no file, or matches only folders; 76 when the destination folder of a wildcard move does not exist; 58 when the destination file exists; 52 when the name of the destination holds a character that Windows does not allow, or is a reserved device name. -> [!NOTE] 1.9.0.0 +> [!NOTE] 2.0.0.0 > A *source* without a wildcard that names a folder is moved too, with no error: `MoveFile "C:\old", "C:\new"` renames the folder. The Scripting Runtime raises error 53. -> [!WARNING] 1.9.0.0 -> A *destination* that is the reserved device name `nul`, in any letter case and with or without an extension (`nul`, `NUL`, `nul.txt`), is not refused. **MoveFile** raises no error, and the file is gone: its contents were moved to the NUL device and cannot be recovered. The Scripting Runtime raises error 58 and leaves the file. [**File.Move**](File#move) and the **MoveFile** of [**FileSystemObject**](FileSystemObject#movefile) do the same; **File.Move** then raises error 53. +A *destination* that is a reserved device name, in any letter case and with or without an extension (`con`, `nul`, `NUL.txt`), raises error 52, and the file stays where it is. [**File.Move**](File#move) and the **MoveFile** of [**FileSystemObject**](FileSystemObject#movefile) do the same. The Scripting Runtime raises error 58 for `nul`. + ### MoveFolder {: .no_toc } @@ -709,7 +708,7 @@ Returns the full path of the moved folder, or the full path of the destination f A destination that is an existing folder gets the source with or without a backslash at the end. The Scripting Runtime raises error 58 when the folder has no backslash. -Errors: 76 when *source* names no folder, or a wildcard matches no folder; 5 for a wildcard in *destination*. +Errors: 76 when *source* names no folder, or a wildcard matches no folder; 5 for a wildcard in *destination*; 52 when *destination* is a reserved device name such as `con` or `nul`, and the folder stays where it is. ### Rename {: .no_toc } @@ -728,7 +727,7 @@ Returns the full path of the renamed item. *newName* cannot move the item to another folder. A change of letter case alone is allowed. -Errors: 53 when *source* does not exist (for a folder as well as a file); 58 when *newName* is the name of another item in that folder; 52 when *newName* holds a character that Windows does not allow; 5 for a wildcard, for a *newName* that leads to another folder, and for a reserved device name such as `con`. +Errors: 53 when *source* does not exist (for a folder as well as a file); 58 when *newName* is the name of another item in that folder; 52 when *newName* holds a character that Windows does not allow, or is a reserved device name such as `con`; 5 for a wildcard, and for a *newName* that leads to another folder. ```tb check_build check_run Dim work As String @@ -838,7 +837,7 @@ A sample looks like binary data when it holds a zero byte, or more than 2% contr The result is an estimate, as every guess about the encoding of a text file is. A file in UTF-16, UTF-32 or UTF-8, with or without a BOM, is found right, except in the cases of the note below; so is a Latin-1 file when the system code page is Latin-1. Pass the encoding to the procedure that reads the file when it is known. -> [!NOTE] 1.9.0.0 +> [!NOTE] 2.0.0.0 > A short file gives little evidence. UTF-16 text with no zero byte, such as eight kanji with no line ending, is reported as **encSystemAnsi**, or as **encUtf8** when its bytes are also valid UTF-8, as for eight hiragana. A few bytes of binary data can be reported as UTF-16. Text in another code page without a BOM is not found: GB18030 text with an accented letter is reported as **encSystemAnsi**, and UTF-7 or Big5 text that is pure ASCII as **encUtf8**. A sample that ends in the first byte of a multi-byte sequence is judged without that byte, so a Latin-1 file whose only accented letter is its last byte is reported as **encUtf8**, and so is a Latin-1 file whose accented letter comes after the first 32,768 bytes. Raises error 53 when the file does not exist; see [Errors](./#errors). @@ -1182,7 +1181,7 @@ Syntax: **ReadStream** ( *filePath*, *stream*() [, *maxBytesToRead* ] ) An empty file, and a *maxBytesToRead* of 0, leave *stream* as it was: an array that already has elements keeps them, and one that has none stays without. Test the array with [**IsArrayInitialized**](../../../Modules/Information/IsArrayInitialized) before indexing it. -Raises error 7 when the whole file is longer than 2,147,483,647 bytes; a head of any size can be read from a larger file. Raises error 53 when the file does not exist. A file that is held open with exclusive access raises an unspecified error, number -2147467259; see [Errors](./#errors). +Raises error 7 when the whole file is longer than 2,147,483,647 bytes; a head of any size can be read from a larger file. Raises error 53 when the file does not exist. A file that is held open with exclusive access raises error 70; see [Errors](./#errors). ### StringToTextFile {: .no_toc } @@ -1524,7 +1523,7 @@ What the mode does: Errors: 53 when the file does not exist for **ForReading**, or for the other modes with *create* **False**; 76 when the folder does not exist; 52 for a name that is not valid when *create* is **True**; 5 for an unknown *ioMode*, and for a binary file as above; 70 when another stream has the file open for writing. The error has an empty **Err.Source** and the standard text of its number, `File not found` for 53, without the path. -> [!NOTE] 1.9.0.0 +> [!NOTE] 2.0.0.0 > A stream in UTF-7 holds the whole file in memory, as [**TextStream**](TextStream#reading-and-writing) describes. For **ForWriting** on a read-only file, the stream opens without an error and the file keeps its text; error 70 comes at the first [**Flush**](TextStream#flush) or [**Close**](TextStream#close). Every other encoding raises error 70 when the stream is opened. > [!IMPORTANT] timeless diff --git a/docs/Reference/Contributed/tbFileSysTools/Folder.md b/docs/Reference/Contributed/tbFileSysTools/Folder.md index 598e2208e..84a89a316 100644 --- a/docs/Reference/Contributed/tbFileSysTools/Folder.md +++ b/docs/Reference/Contributed/tbFileSysTools/Folder.md @@ -106,27 +106,25 @@ Syntax: *object*.**Files** **As Files** Returns a [**Files**](Files) collection of the files directly in the folder. Hidden and system files are in it, which differs from [**GetFilePaths**](FileSystemTools#getfilepaths). The folder is read when the property is read, and the collection does not change afterwards. Raises error 70 when the folder cannot be read, as the Scripting Runtime does. -> [!NOTE] 1.9.0.0 -> **Files**, [**SubFolders**](#subfolders) and [**Size**](#size) raise error 76 (*Path not found*) for a folder whose path has 258 characters or more, although the folder exists and its [**Name**](#name) can be read. The same members work for a folder with 256 characters. +**Files**, [**SubFolders**](#subfolders) and [**Size**](#size) work for a folder whose path is longer than 260 characters. ```tb check_build check_run -Dim work As String, deep As String, n As Long +Dim work As String, deep As String work = BuildPath(Environ$("TEMP"), GetTempName("fst", "")) deep = work Do While Len(deep) < 270 deep = BuildPath(deep, String$(25, "d")) Loop CreateFolder deep, True +StringToTextFile "abc", BuildPath(deep, "a.txt") -Debug.Print Len(GetFolder(deep).Name) ' 25 -On Error Resume Next -n = GetFolder(deep).Files.Count -Debug.Print Err.Number ' 76 -Err.Clear -On Error GoTo 0 +Debug.Print Len(deep) > 260 ' True +Debug.Print GetFolder(deep).Files.Count ' 1 +Debug.Print GetFolder(deep).Size ' 3 DeleteFolder work ``` + ### HasAttribute {: .no_toc } @@ -203,7 +201,7 @@ Syntax: *object*.**Size** **As LongLong** The tree is read again on every call, which takes time for a large tree. Hidden and system files are counted. A directory junction or symbolic link is not entered, so each file is counted once, where it is stored. The Scripting Runtime enters a link, and counts the files below its target twice when the link leads to a folder in the same tree: for a folder that holds 1,500 bytes, with a junction to one of its subfolders, **Size** returns 1,500 here and 2,500 with the Scripting Runtime (the sample under [Junctions and symbolic links](FileSystemTools#junctions-and-symbolic-links) shows it). -Raises error 70 when a folder in the tree cannot be read, as the Scripting Runtime does. Raises error 76 when the folder, or a folder below it, has a path of 258 characters or more; see [Files](#files). +Raises error 70 when a folder in the tree cannot be read, as the Scripting Runtime does. ### SubFolders {: .no_toc } diff --git a/docs/Reference/Contributed/tbFileSysTools/Folders.md b/docs/Reference/Contributed/tbFileSysTools/Folders.md index 40782588a..9be371db1 100644 --- a/docs/Reference/Contributed/tbFileSysTools/Folders.md +++ b/docs/Reference/Contributed/tbFileSysTools/Folders.md @@ -77,7 +77,7 @@ Syntax: *object*.**Add** ( *name* ) **As Folder** Creates the folder below the folder that the collection was read from, appends it to the collection, and returns it. [**Count**](#count) and [**Item**](#item) show it at once, and **Item** finds it by *name*. Any other **Folders** that was read from the same folder is not changed; reading [**SubFolders**](Folder#subfolders) again includes the new folder. -Errors: 58 when the folder already exists, and for an empty *name*, which names the folder that holds the collection; 5 when *name* holds a slash; 52 for a name with `<`, `>`, `"`, `|`, `?`, `*` or a control character; 75 for a reserved device name such as `con`. The numbers are those of [**CreateFolder**](FileSystemTools#createfolder), which does the work. The Scripting Runtime has this method too. It raises error 58 for an existing folder and error 5 for a path, as here, and also error 5 for an empty *name*. +Errors: 58 when the folder already exists, and for an empty *name*, which names the folder that holds the collection; 5 when *name* holds a slash; 52 for a name with `<`, `>`, `"`, `|`, `?`, `*` or a control character, and for a reserved device name such as `con`. The numbers are those of [**CreateFolder**](FileSystemTools#createfolder), which does the work. The Scripting Runtime has this method too. It raises error 58 for an existing folder and error 5 for a path, as here, and also error 5 for an empty *name*. ```tb check_build check_run Dim work As String, fs As Folders, nf As Folder diff --git a/docs/Reference/Contributed/tbFileSysTools/TextStream.md b/docs/Reference/Contributed/tbFileSysTools/TextStream.md index e3d4108fe..b0127d039 100644 --- a/docs/Reference/Contributed/tbFileSysTools/TextStream.md +++ b/docs/Reference/Contributed/tbFileSysTools/TextStream.md @@ -80,7 +80,7 @@ DeleteFolder work **Two modes.** Most encodings, UTF-8 among them, are read and written in pieces of 64 KB, and [**IsStreaming**](#isstreaming) is **True**. UTF-7 cannot be cut into pieces. A stream in UTF-7 holds the whole file in memory and [**IsStreaming**](#isstreaming) is **False**. Every member works in both modes. -> [!NOTE] 1.9.0.0 +> [!NOTE] 2.0.0.0 > A stream of this kind that is open for writing does not empty the file when it is opened: the file is replaced when the stream is closed or flushed. When the file is read-only, the stream opens without an error, the file keeps its text, and the first [**Flush**](#flush) or [**Close**](#close) fails with error 70. **Position.** [**Line**](#line) and [**Column**](#column) follow the characters that are read or written. Reading a line moves past its line ending. diff --git a/docs/Reference/Contributed/tbFileSysTools/index.md b/docs/Reference/Contributed/tbFileSysTools/index.md index 3e88a2964..254a2a5da 100644 --- a/docs/Reference/Contributed/tbFileSysTools/index.md +++ b/docs/Reference/Contributed/tbFileSysTools/index.md @@ -6,14 +6,14 @@ exclude_from_docs: - FSTShared - TextCodec - WinAPI -indexed_from: 1.9.0.0 +indexed_from: 2.0.0.0 permalink: /tB/Packages/Contributed/tbFileSysTools/ --- # tbFileSysTools Package {: .no_toc } -**Author:** GCuser99. **Version:** 1.9.0.0. **On GitHub:** [GCuser99/tbFileSysTools](https://github.com/GCuser99/tbFileSysTools), in the folder *Package*. +**Author:** GCuser99. **Version:** 2.0.0.0. **On GitHub:** [GCuser99/tbFileSysTools](https://github.com/GCuser99/tbFileSysTools), in the folder *Package*. The **tbFileSysTools** contributed package, listed on the Available Packages tab of Project Settings as *File System Tools - Modern Replacement for FSO*, reads and changes files, folders and drives, as the **FileSystemObject** of the Scripting Runtime does, and is written in twinBASIC. It reads and writes text files in any Windows code page, with detection of the encoding and handling of byte-order marks (BOMs), detects and converts line endings, streams files of any size, and works with paths longer than 260 characters. @@ -123,13 +123,8 @@ The procedures raise the error numbers that VB6 uses for the same failures. **Er Windows reports a failure with its own code, and the package maps it to one of those numbers: *file not found* (2) to 53, *path not found* (3) and *bad directory name* (267) to 76, *file exists* (80 and 183) to 58, *access denied* and the sharing violations (5, 32 and 33) to 70, and *invalid name* (123) to 52. - -> [!NOTE] 1.9.0.0 -> A few failures raise a number that is not the one the same failure raises elsewhere in the package. The sample shows the first two. -> -> - A file that is held open with exclusive access raises the unspecified error -2147467259 when it is read, by [**TextFileToString**](FileSystemTools#textfiletostring), [**GetFileEncoding**](FileSystemTools#getfileencoding), [**ReadStream**](FileSystemTools#readstream) and the other procedures that read a whole file. Writing to it raises 70. -> - A reserved device name, such as `con` or `nul`, raises 52 in the procedures that write a file ([**StringToTextFile**](FileSystemTools#stringtotextfile), [**ArrayToTextFile**](FileSystemTools#arraytotextfile), [**CreateTextFile**](FileSystemTools#createtextfile), [**OpenTextFile**](FileSystemTools#opentextfile) with *create* **True**, [**Folder.CreateTextFile**](Folder#createtextfile)) and in [**CopyFile**](FileSystemTools#copyfile). It raises other numbers elsewhere. [**CreateFolder**](FileSystemTools#createfolder) raises 75 for `con` and 76 for `nul`; [**MoveFile**](FileSystemTools#movefile) raises 75 for `con`, and for `nul` it raises nothing, which has a warning of its own; [**MoveFolder**](FileSystemTools#movefolder) raises 75 for `con` and 70 for `nul`; [**Rename**](FileSystemTools#rename) raises 5. -> - [**Folder.Files**](Folder#files), [**SubFolders**](Folder#subfolders) and [**Size**](Folder#size) raise error 76 for a folder whose path has 258 characters or more. + +A file that is held open with exclusive access raises error 70 when it is read, by [**TextFileToString**](FileSystemTools#textfiletostring), [**GetFileEncoding**](FileSystemTools#getfileencoding), [**ReadStream**](FileSystemTools#readstream) and the other procedures that read a whole file, and when it is written. A reserved device name, such as `con` or `nul`, raises error 52 in the procedures that write a file, in [**CopyFile**](FileSystemTools#copyfile), [**CreateFolder**](FileSystemTools#createfolder), [**MoveFile**](FileSystemTools#movefile), [**MoveFolder**](FileSystemTools#movefolder) and [**Rename**](FileSystemTools#rename), and nothing is created or moved. ```tb check_build check_run Dim work As String, p As String, s As String, fn As Long @@ -142,7 +137,7 @@ On Error Resume Next fn = FreeFile() Open p For Binary Access Read Write Lock Read Write As #fn s = TextFileToString(p) -Debug.Print Err.Number ' -2147467259 +Debug.Print Err.Number ' 70 Err.Clear StringToTextFile "y", p Debug.Print Err.Number ' 70 @@ -153,15 +148,16 @@ StringToTextFile "x", BuildPath(work, "con") Debug.Print Err.Number ' 52 Err.Clear CreateFolder BuildPath(work, "con") -Debug.Print Err.Number ' 75 +Debug.Print Err.Number ' 52 Err.Clear Rename p, "con" -Debug.Print Err.Number ' 5 +Debug.Print Err.Number ' 52 Err.Clear On Error GoTo 0 DeleteFolder work ``` + In the procedures that read or write the text or the bytes of a file, a file that does not exist raises error 53, and a folder that does not exist raises 76. diff --git a/indexer/snapshots/contributed/VBA_JSON/api.json b/indexer/snapshots/contributed/VBA_JSON/api.json index 4860f2674..0d641ff1e 100644 --- a/indexer/snapshots/contributed/VBA_JSON/api.json +++ b/indexer/snapshots/contributed/VBA_JSON/api.json @@ -2,7 +2,7 @@ "format": 4, "package": "VBA_JSON", "project": "VBA_JSON", - "version": "2.3.1.1", + "version": "2.3.2.1", "types": [ { "name": "Dictionary", @@ -16,6 +16,7 @@ {"name":"Item","kind":"property","vis":"public","signature":"Public Property Let Item(ByVal Key As String, Value As Variant)","accessor":"Let"}, {"name":"Item","kind":"property","vis":"public","signature":"Public Property Set Item(ByVal Key As String, Value As Variant)","accessor":"Set"}, {"name":"Keys","kind":"property","vis":"public","signature":"Public Property Get Keys() As Variant","returnType":"Variant","accessor":"Get"}, + {"name":"New","kind":"sub","vis":"public","signature":"Public Sub New()"}, {"name":"_NewEnum","kind":"function","vis":"private","signature":"Private Function _NewEnum() As Variant","returnType":"Variant","attrs":[{"name":"Enumerator"}]}, {"name":"m_Collection","kind":"field","vis":"private","signature":"Private m_Collection As Collection = New Collection"} ] diff --git a/indexer/snapshots/contributed/tbFileSysTools/api.json b/indexer/snapshots/contributed/tbFileSysTools/api.json index 0d2680692..2ff4f4dc9 100644 --- a/indexer/snapshots/contributed/tbFileSysTools/api.json +++ b/indexer/snapshots/contributed/tbFileSysTools/api.json @@ -2,7 +2,7 @@ "format": 4, "package": "tbFileSysTools", "project": "tbFileSysTools", - "version": "1.9.0.0", + "version": "2.0.0.0", "types": [ { "name": "Drive", @@ -324,6 +324,7 @@ {"name":"NormalizeTextFile","kind":"function","vis":"public","signature":"Public Function NormalizeTextFile(ByVal filePath As String, Optional ByVal toEncoding As TextEncoding = encUtf8, Optional ByVal toNewLine As NewlineType = nlWindows, Optional ByVal fromEncoding As TextEncoding = encAutoDetect, Optional ByVal toAttributes As FileAttribute = faNoChange) As Boolean","returnType":"Boolean","description":"Rewrites a text file in place in the target encoding and newline style (source auto-detected). toAttributes enforces a target attribute set (settable bits only); NoChange (the default) preserves the file's current attributes, including ReadOnly. Skips the write when content is already in target form. Refuses binary files. Returns True if the file was modified."}, {"name":"OpenTextFile","kind":"function","vis":"public","signature":"Public Function OpenTextFile(ByVal filePath As String, Optional ByVal ioMode As IOMode = ForReading, Optional ByVal create As Boolean = False, Optional ByVal encoding As TextEncoding = encAutoDetect, Optional ByVal writeModeLineEnding As NewlineType = nlWindows) As TextStream","returnType":"TextStream","description":"Opens a text file and returns a streaming TextStream. For reading, omit encoding (encAutoDetect) to detect it from a head sample. For writing/appending, encoding selects the output encoding (default UTF-8, no BOM). Encodings whose chunk boundaries cannot be managed (UTF-7, unclassifiable code pages) transparently fall back to a buffered path."}, {"name":"PathExists","kind":"function","vis":"private","signature":"Private Function PathExists(ByVal path As String) As Boolean","returnType":"Boolean"}, + {"name":"PathParts","kind":"function","vis":"private","signature":"Private Function PathParts(ByVal path As String, ByVal rootLen As Long) As Collection","returnType":"Collection"}, {"name":"PeekWord","kind":"function","vis":"private","signature":"Private Function PeekWord(ByVal p As LongPtr) As Integer","returnType":"Integer"}, {"name":"PtrToStringW","kind":"function","vis":"private","signature":"Private Function PtrToStringW(ByVal pStr As LongPtr, ByVal charLen As Long) As String","returnType":"String"}, {"name":"ReadStream","kind":"sub","vis":"public","signature":"Public Sub ReadStream(ByVal filePath As String, ByRef stream() As Byte, Optional ByVal maxBytesToRead As Long = -1)","description":"Reads the file specified into a byte array."}, diff --git a/scripts/shoot_docs.mjs b/scripts/shoot_docs.mjs index f858dd0ca..b5f548044 100644 --- a/scripts/shoot_docs.mjs +++ b/scripts/shoot_docs.mjs @@ -2041,7 +2041,7 @@ const SETUPS = { start: (run) => startPrograms(run, WAYNES_SHOTS), prepare: (run) => preparePrograms(run, "WaynesShots"), }, - tbide: { start: startTbIde, prepare: prepareTbIde }, + tbide: { start: startTbIde, prepare: prepareTbIde, end: endBuilding }, "tbide-sample10": { start: startTbIdeSample10, prepare: prepareTbIdeSample10 }, addins: { start: startAddins, prepare: prepareAddins }, codelens: { start: startCodeLens, prepare: prepareSample }, @@ -15785,6 +15785,11 @@ const TBIDE_IMAGE = (name) => `Reference/Built-In/tbIDE/Images/${name}.png`; const TBIDE_BUTTON = (n) => `addinButton-MyAddInButton${n}`; const TBIDE_WINDOW = "MyAddIn.MyWindowPosition"; const S10_WINDOW = "WaynesWindowData"; +// What the console prints when the compiler restarts with Shift held, and the floated console +// that shows it: wide enough for its two lines on one row each, and tall enough for both in +// either theme, so that fitConsole does not grow it (grown, it came out 19 px taller in dark). +const SHIFT_LINE = "[IDE] SHIFT KEY DETECTED: DISABLED LOADING OF ADDINS"; +const SHIFT_CONSOLE = { width: 560, height: 110 }; async function startTbIde(run) { const { lane, work } = run; @@ -15797,8 +15802,11 @@ async function startTbIde(run) { say(run.name, `building ${path.relative(REPO_ROOT, TBIDE)} into a copy of ${ide}`); await lane.addAddin(src); run.step = "open"; - say(run.name, `opening ${path.relative(REPO_ROOT, SAMPLE)}`); - return lane.open(stageSample(run)); + // in a folder under the tool's own, shown as SHOWN_ROOT: a restart of the compiler prints the + // project's path (Restart_Without_Addins) + const dir = runFolder(run, "TbIde"); + say(run.name, `opening ${path.relative(REPO_ROOT, SAMPLE)} in ${dir}`); + return lane.open(stageSample(run), { folder: dir }); } async function startTbIdeSample10(run) { @@ -16042,6 +16050,102 @@ const tbIdeShots = [ } }, }, + { + // index.md's Rebuilding an addin the IDE has loaded: the toolbar's restart button, ringed, + // "+ Shift" under it, and an arrow to the line the console prints when the compiler restarts + // with Shift held. The restart is a real one, Shift held down in the page as a person holds + // it (the page follows Shift by keydown and keyup since BETA 1045), and MyAddIn's buttons not + // coming back says the add-in did not load. Then a restart without Shift loads it again. + out: TBIDE_IMAGE("Restart_Without_Addins"), + setup: "tbide", + async take({ c }) { + await resetUi(c); + const shift = { key: "Shift", code: "ShiftLeft", windowsVirtualKeyCode: 16 }; + let held = false; + try { + await floatPanel(c, "DEBUG CONSOLE", SHIFT_CONSOLE); + await clearConsole(c); + const pid = await compilerPid(c); + await c.send("Input.dispatchKeyEvent", { type: "rawKeyDown", ...shift, modifiers: 8 }); + held = true; + await click(c, "restartIcon"); + await compilerBack(c, pid); + const shown = await waitFor(c, async () => (await consoleText(c)).includes(SHIFT_LINE), { + timeout: 15000, + interval: 100, + }); + await c.send("Input.dispatchKeyEvent", { type: "keyUp", ...shift }); + held = false; + if (!shown) throw new Error(`the console has no ${SHIFT_LINE} line: ${JSON.stringify(await consoleText(c))}`); + if (await rectOf(c, `#${TBIDE_BUTTON(2)}`)) throw new Error("MyAddIn loaded with Shift held"); + // what else the restart printed: the picture shows the console's lines since it was emptied + const lines = await c.evaluate("debugConsoleContent.dataNodes.map((l) => l.replace(/<[^>]*>/g, ''))"); + say(c.shot.name, ` the console's lines: ${JSON.stringify(lines)}`); + const { reference, prefer, ignore } = c.shot; + Object.assign(c.shot, { reference: null, prefer: null, ignore: null }); + let made; + try { + await resetUi(c); + // the button with the build target's box before it, by which a reader finds it + const icon = await rectOf(c, "#restartIcon"); + const target = await rectOf(c, "#buildConfigSelector"); + const bar = await toolbarRect(c); + if (!icon || !target || !bar) throw new Error("the toolbar has no restart button or no build target box"); + const left = target.x - 8; + // on the right, short of the next button, which a wider clip shows a sliver of + const iconClip = snapOut({ x: left, y: bar.y, width: icon.x + icon.width + 3 - left, height: bar.height }); + const iconPng = await capture(c, "Restart_Without_Addins-button", iconClip, { away: () => parkMouse(c) }); + const consolePng = await consolePicture(c, "Restart_Without_Addins-console", lines.length); + const consoleClip = snapOut(await rectOf(c, panelSel("DEBUG CONSOLE"))); + const row = await c.evaluate(`(() => { + const p = document.querySelector(${JSON.stringify(panelSel("DEBUG CONSOLE"))}); + const e = [...p.querySelectorAll(".listItems .listitem")].find((x) => x.textContent.includes(${JSON.stringify(SHIFT_LINE)}) && x.getBoundingClientRect().height); + if (!e) return null; + const r = e.getBoundingClientRect(); + return { x: r.x, y: r.y, width: r.width, height: r.height }; +})()`); + if (!row) throw new Error("the console draws no row with the line"); + made = [ + { png: iconPng, clip: iconClip, anchors: { restart: icon }, column: 0 }, + { png: consolePng, clip: consoleClip, anchors: { line: row }, column: 1 }, + ]; + } finally { + Object.assign(c.shot, { reference, prefer, ignore }); + } + try { + const { box } = await composite( + c, + made, + [ + { type: "ring", on: { ref: "restart" } }, + { type: "label", text: "+ Shift", on: { ref: "restart" }, side: "below", gap: 10 }, + { + type: "arrow", + from: { of: { ref: "restart" }, at: "right", dx: 12 }, + to: { of: { ref: "line" }, at: "left", dx: -4 }, + }, + ], + { gap: 72, margin: 24, align: { from: "restart", to: "line", dy: 0 } }, + ); + return await capture(c, "Restart_Without_Addins", snapOut(box), { away: () => parkMouse(c) }); + } finally { + await uncomposite(c); + } + } finally { + if (held) await c.send("Input.dispatchKeyEvent", { type: "keyUp", ...shift }); + // the add-in loaded again by a restart without Shift; the console emptied while it is + // floated, since docked its Clear button is not shown + if (!(await rectOf(c, `#${TBIDE_BUTTON(2)}`))) { + const pid = await compilerPid(c); + await click(c, "restartIcon"); + await compilerBack(c, pid); + await addinButtonShown(c, TBIDE_BUTTON(2), "MyAddIn"); + } + await clearConsole(c); + await unfloatPanel(c, "DEBUG CONSOLE"); + } + }, + }, { // Sample 10's tool window of styled div elements (HtmlElement.md), shown by its own button out: TBIDE_IMAGE("Sample10"), diff --git a/test/addin/datasheet.test.mjs b/test/addin/datasheet.test.mjs index 773225c9c..a585626bb 100644 --- a/test/addin/datasheet.test.mjs +++ b/test/addin/datasheet.test.mjs @@ -9,9 +9,10 @@ // // Each test states what BETA 1045 does. If one fails after an IDE update, the // IDE has changed: update the tbIDE pages that rest on it, -// docs/Reference/Built-In/tbIDE/Datasheet.md, HtmlElements.md and -// HtmlEventProperties.md, then .claude/beta1045/probe-datasheet.md's answer, -// and then this file. +// docs/Reference/Built-In/tbIDE/Datasheet.md, HtmlElements.md, +// HtmlEventProperties.md and Themes.md, then the steps of the reproducers that +// name a test here (bugs/datasheet-*/repro.json), and then this file. A test +// whose comment names an IDE defect asserts the defect: it fails once it is fixed. // // Run it with addin-test.bat, which gives it a lane; on its own it is skipped. @@ -322,8 +323,7 @@ scenario("The datasheet element in a tool window", (lane) => { assert.equal(await cmd(c, "load"), "String OK"); assert.ok(await waitFor(c, async (c) => (await state(c)) === "ready", { timeout: 10000, interval: 50 })); assert.equal(await lastError(c), ""); - await sleep(1000); - const lines = await probeLines(c, mark); + const lines = await linesUpTo(mark, "rows 128-256"); assert.deepEqual(lines.slice(0, 4), [ "cmd load -> String OK", "info asked, argsIpcCached True", @@ -347,20 +347,29 @@ scenario("The datasheet element in a tool window", (lane) => { // The probe's rows 0 to 7 (RowJson). Grid column 0 is the record selector, // whose triangle at the current record is a moveTo too; 1 to 3 are id // (integer), name (string) and flag (boolean). - test("what the grid draws: the header, a 0 as nothing, no number formatting, a tick only for true", async () => { + test("what the grid draws: the header, no number formatting, a tick only for true", async () => { const p = await painted(c); assert.deepEqual(p.header, { 1: { text: "id" }, 2: { text: "Full name" }, 3: { text: "flag" } }); - const rows = Object.fromEntries([0, 1, 2, 3, 4, 5, 6, 7].map((r) => [r, p[r]])); + // Rows 1 to 6 hold no 0; rows 0 and 7 are the next test's. + const rows = Object.fromEntries([1, 2, 3, 4, 5, 6].map((r) => [r, p[r]])); assert.deepEqual(rows, { - 0: { 0: { tick: true }, 3: { tick: true } }, // [0, null, true]: the 0 draws nothing 1: { 1: { text: "1" }, 2: { text: "42" } }, // [1, 42, false]: false is an empty box 2: { 1: { text: "2" }, 2: { text: "true" }, 3: { dash: true } }, // [2, true, null] 3: { 1: { text: "3" }, 2: { text: "1.5" } }, // [3, 1.5, 1]: 1 is an empty box 4: { 1: { text: "4" }, 2: { text: "x" } }, // [4, "x", "true"]: so is "true" 5: { 1: { text: "5" }, 2: { text: "[object Object]" } }, // [5, {"a":1}, false] 6: { 1: { text: "1234567.891" }, 2: { text: "Name 6" }, 3: { tick: true } }, - 7: { 1: { text: "seven" } }, // ["seven", 0, false]: text in an integer column; 0 again nothing }); + // The cells beside the zeros draw as they should. + assert.deepEqual(p["0"]?.["3"], { tick: true }); // [0, null, true] + assert.deepEqual(p["7"]?.["1"], { text: "seven" }); // ["seven", 0, false]: text in an integer column + }); + + // An IDE defect, datasheet-zero-drawn-blank: a cell holding the number 0 draws nothing. + test("a 0 draws nothing, in an integer column and in a string column", async () => { + const p = await painted(c); + assert.deepEqual(p["0"], { 0: { tick: true }, 3: { tick: true } }); // [0, null, true]: no "0" in column 1 + assert.deepEqual(p["7"], { 1: { text: "seven" } }); // ["seven", 0, false]: no "0" in column 2 }); test("showNulls(True) draws a null as the text null, except in a boolean column", async () => { @@ -443,12 +452,16 @@ scenario("The datasheet element in a tool window", (lane) => { }); test("navigateToRecord: 1-based, clamped, truncated; getSelectedRows zero-based", async () => { - const at = async (n) => [await cmd(c, `nav|${n}`), await cmd(c, "selected"), (await navigator(c)).record]; + const at = async (n, how = "nav") => [ + await cmd(c, `${how}|${n}`), + await cmd(c, "selected"), + (await navigator(c)).record, + ]; assert.deepEqual(await at(150), ["String OK", "String 149:149", "150"]); assert.deepEqual(await at(0), ["String OK", "String 0:0", "1"]); assert.deepEqual(await at(99999), ["String OK", "String 299:299", "300"]); - // CLng(12.7) is 13 before the call: the probe passes a Long. - assert.deepEqual(await at(12.7), ["String OK", "String 12:12", "13"]); + // A Double from twinBASIC: 12.7 is record 12, its fraction dropped. + assert.deepEqual(await at(12.7, "navdouble"), ["String OK", "String 11:11", "12"]); assert.equal(await cmd(c, "selectall"), "Null"); assert.equal(await cmd(c, "selected"), "String 0:299"); await cmd(c, "nav|1"); @@ -506,59 +519,121 @@ scenario("The datasheet element in a tool window", (lane) => { ); }); + // The current record, read until it is `want` or a second has passed. + const selectedIs = async (want) => + (await waitFor(c, async () => ((await cmd(c, "selected")) === want ? want : null), { + timeout: 1000, + interval: 100, + })) ?? (await cmd(c, "selected")); + test("keys: Up and Down move the current record; PageDown scrolls without moving it", async (t) => { await press(c, await cellPoint(c, 2, 8)); - assert.equal(await cmd(c, "selected"), "String 8:8"); + assert.equal(await selectedIs("String 8:8"), "String 8:8"); await pressKey(c, "ArrowDown"); - await sleep(200); - assert.equal(await cmd(c, "selected"), "String 9:9"); + assert.equal(await selectedIs("String 9:9"), "String 9:9"); await pressKey(c, "ArrowUp"); await pressKey(c, "ArrowUp"); - await sleep(200); - assert.equal(await cmd(c, "selected"), "String 7:7"); - await pressKey(c, "ArrowDown", { shift: true }); - await sleep(200); - assert.equal(await cmd(c, "selected"), "String 7:7"); - // The keys left to Hypergrid: each throws inside fin-hypergrid.min.js, and - // neither the current record nor the current cell moves. - const TYPE_ERROR = "TypeError: Cannot read properties of null (reading 'x')"; - for (const [key, mods, threw] of [ - ["ArrowRight", {}, TYPE_ERROR], - ["Tab", {}, TYPE_ERROR], - ["ArrowLeft", {}, TYPE_ERROR], - ["Home", {}, "page left not yet implemented"], - ["End", {}, "page right not yet implemented"], - ["End", { ctrl: true }, "page right not yet implemented"], - ["Home", { ctrl: true }, "page left not yet implemented"], - ]) { - const n = exceptions.length; - await pressKey(c, key, mods); - await sleep(250); - const name = `${mods.ctrl ? "Ctrl+" : ""}${key}`; - assert.deepEqual( - { - name, - selected: await cmd(c, "selected"), - cell: await c.evaluate(`${GRID}.selectionModel.getLastSelection()?.origin`), - vscroll: await vscroll(c), - threw: exceptions.slice(n).map((e) => ({ message: e.description || e.value, file: path.basename(e.url) })), - }, - { - name, - selected: "String 7:7", - cell: { x: 2, y: 7 }, - vscroll: 0, - threw: [{ message: threw, file: "fin-hypergrid.min.js" }], - }, - ); - } - exceptions.length = 0; // asserted above; the run's last test reports any others + assert.equal(await selectedIs("String 7:7"), "String 7:7"); const v0 = await vscroll(c); await pressKey(c, "PageDown"); - await sleep(300); + assert.ok(await waitFor(c, async () => (await vscroll(c)) > v0, { timeout: 2000, interval: 100 })); t.diagnostic(`PageDown: from ${v0} to ${await vscroll(c)}`); assert.equal(await cmd(c, "selected"), "String 7:7"); - assert.ok((await vscroll(c)) > v0); + await cmd(c, "nav|1"); + }); + + // What one key does from a fresh click on the data cell in column 2, row 7: the current record, + // the current cell, the scroll and what the page threw. `before` keys are pressed first. + async function keyFromClick(key, mods = {}, before = []) { + await cmd(c, "nav|1"); + await press(c, await cellPoint(c, 2, 7)); + assert.equal(await selectedIs("String 7:7"), "String 7:7"); + for (const [k, m] of before) { + await pressKey(c, k, m); + await sleep(250); + } + const n = exceptions.length; + await pressKey(c, key, mods); + await sleep(250); + const r = { + selected: await cmd(c, "selected"), + cell: await c.evaluate(`${GRID}.selectionModel.getLastSelection()?.origin ?? null`), + vscroll: await vscroll(c), + threw: exceptions.slice(n).map((e) => ({ message: e.description || e.value, file: path.basename(e.url) })), + }; + return r; + } + + test("keys after a click: Right, Left and Tab move the current cell, Shift+Down the current record", async () => { + const n0 = exceptions.length; + const got = {}; + for (const [name, key, mods] of [ + ["Right", "ArrowRight", {}], + ["Left", "ArrowLeft", {}], + ["Tab", "Tab", {}], + ["Shift+Down", "ArrowDown", { shift: true }], + ]) { + got[name] = await keyFromClick(key, mods); + } + const moved = (selected, x, y) => ({ selected, cell: { x, y }, vscroll: 0, threw: [] }); + assert.deepEqual(got, { + Right: moved("String 7:7", 3, 7), + Left: moved("String 7:7", 1, 7), + Tab: moved("String 7:7", 3, 7), + "Shift+Down": moved("String 8:8", 2, 8), + }); + assert.equal(exceptions.length, n0); + await cmd(c, "nav|1"); + }); + + // IDE defects, datasheet-keys-throw: Home and End are not implemented, and once Up or Down + // has moved the current record, the keys that move the current cell throw until the next click. + test("keys: Home and End throw; after Up or Down, Right, Left, Tab and Shift+Down throw and move nothing", async () => { + const n0 = exceptions.length; + const TYPE_ERROR = "TypeError: Cannot read properties of null (reading 'x')"; + const stayed = (selected, x, y, message) => ({ + selected, + cell: { x, y }, + vscroll: 0, + threw: [{ message, file: "fin-hypergrid.min.js" }], + }); + const got = {}; + for (const [name, key, mods, before] of [ + ["Home", "Home", {}, []], + ["End", "End", {}, []], + ["Ctrl+Home", "Home", { ctrl: true }, []], + ["Ctrl+End", "End", { ctrl: true }, []], + ["Right after Down", "ArrowRight", {}, [["ArrowDown", {}]]], + ["Left after Down", "ArrowLeft", {}, [["ArrowDown", {}]]], + ["Tab after Down", "Tab", {}, [["ArrowDown", {}]]], + ["Shift+Down after Down", "ArrowDown", { shift: true }, [["ArrowDown", {}]]], + ["Right after Up", "ArrowRight", {}, [["ArrowUp", {}]]], + [ + "Right after Down and Right", + "ArrowRight", + {}, + [ + ["ArrowDown", {}], + ["ArrowRight", {}], + ], + ], + ]) { + got[name] = await keyFromClick(key, mods, before); + } + assert.deepEqual(got, { + Home: stayed("String 7:7", 2, 7, "page left not yet implemented"), + End: stayed("String 7:7", 2, 7, "page right not yet implemented"), + "Ctrl+Home": stayed("String 7:7", 2, 7, "page left not yet implemented"), + "Ctrl+End": stayed("String 7:7", 2, 7, "page right not yet implemented"), + "Right after Down": stayed("String 8:8", 2, 8, TYPE_ERROR), + "Left after Down": stayed("String 8:8", 2, 8, TYPE_ERROR), + "Tab after Down": stayed("String 8:8", 2, 8, TYPE_ERROR), + "Shift+Down after Down": stayed("String 8:8", 2, 8, TYPE_ERROR), + "Right after Up": stayed("String 6:6", 2, 6, TYPE_ERROR), + "Right after Down and Right": stayed("String 8:8", 2, 8, TYPE_ERROR), + }); + // Asserted above. Only these go: the run's last test reports any others, earlier ones included. + exceptions.splice(n0); await cmd(c, "nav|1"); }); @@ -606,24 +681,36 @@ scenario("The datasheet element in a tool window", (lane) => { await cmd(c, "nav|1"); }); + // The probe's lines since `mark` once `last` is among them, or after `timeout` ms. + const linesUpTo = async (mark, last, timeout = 5000) => + (await waitFor( + c, + async () => { + const l = await probeLines(c, mark); + return l.includes(last) ? l : null; + }, + { timeout, interval: 100 }, + )) ?? (await probeLines(c, mark)); + const stateIs = async (want, timeout = 5000) => + (await waitFor(c, async () => ((await state(c)) === want ? want : null), { timeout, interval: 100 })) ?? + (await state(c)); + test("refresh asks onGetInfo again; a new column count is SCHEMA_CHANGED; the old count recovers", async () => { let mark = await consoleMark(c); await setReplies(c, { info: INFO() }); assert.equal(await cmd(c, "refresh"), "String OK"); - await sleep(1000); - assert.equal(await state(c), "ready"); - assert.deepEqual(await probeLines(c, mark), [ + assert.deepEqual(await linesUpTo(mark, "rows 128-256"), [ "cmd refresh -> String OK", "info asked, argsIpcCached True", "info resolved", "rows 0-128", "rows 128-256", ]); + assert.equal(await state(c), "ready"); mark = await consoleMark(c); await setReplies(c, { info: INFO(4) }); assert.equal(await cmd(c, "refresh"), "String OK"); - await sleep(1000); - assert.equal(await state(c), "error"); + assert.equal(await stateIs("error"), "error"); assert.equal( await lastError(c), "SCHEMA_CHANGED: provider column count changed from 3 to 4; recreate the datasheet with loadData() in a new designer", @@ -632,44 +719,67 @@ scenario("The datasheet element in a tool window", (lane) => { mark = await consoleMark(c); await setReplies(c, { info: INFO(3, 50) }); assert.equal(await cmd(c, "refresh"), "String OK"); - await sleep(1000); - assert.equal(await state(c), "ready"); + assert.deepEqual((await linesUpTo(mark, "rows 0-50")).slice(3), ["rows 0-50"]); + assert.equal(await stateIs("ready"), "ready"); assert.equal(await lastError(c), ""); - assert.deepEqual((await probeLines(c, mark)).slice(3), ["rows 0-50"]); assert.equal((await navigator(c)).text, "of 50 records"); + mark = await consoleMark(c); await setReplies(c, { info: INFO() }); await cmd(c, "refresh"); - await sleep(1000); + await linesUpTo(mark, "rows 128-256"); }); test("a reply with a row too few: the page is asked again after 750, 1500, 3000 and 6000 ms, then no more until refresh", async (t) => { await setReplies(c, { rows: "(short)" }); await rowsAsked(c); assert.equal(await cmd(c, "refresh"), "String OK"); - await sleep(13000); - const asked = await rowsAsked(c); + // Every request is kept here: rowsAsked empties the page's list. + const asked = []; + const page0 = () => asked.filter((a) => a.start === 0); + assert.ok( + await waitFor( + c, + async () => { + asked.push(...(await rowsAsked(c))); + return page0().length >= 5; + }, + { timeout: 15000, interval: 200 }, + ), + `page 0 asked ${page0().length} times`, + ); + // The back-off is capped at 12000 ms: a sixth request would come within that of the fifth. + await sleep(12500); + asked.push(...(await rowsAsked(c))); const t0 = asked[0].t; - const page0 = asked.filter((a) => a.start === 0).map((a) => Math.round(a.t - t0)); + const at = page0().map((a) => Math.round(a.t - t0)); t.diagnostic( - `page 0 asked at ${JSON.stringify(page0)} ms; page 128 ${asked.filter((a) => a.start === 128).length} time(s)`, + `page 0 asked at ${JSON.stringify(at)} ms; page 128 ${asked.filter((a) => a.start === 128).length} time(s)`, ); - assert.equal(page0.length, 5); - const gaps = page0.slice(1).map((v, i) => v - page0[i]); + assert.equal(at.length, 5); + const gaps = at.slice(1).map((v, i) => v - at[i]); for (const [i, want] of [750, 1500, 3000, 6000].entries()) assert.ok(gaps[i] >= want && gaps[i] < want + 200, `gaps ${JSON.stringify(gaps)}`); // Row failures leave the state and the last error alone. assert.equal(await state(c), "ready"); assert.equal(await lastError(c), ""); await setReplies(c, { rows: "" }); - await sleep(1500); - assert.deepEqual(await rowsAsked(c), []); assert.equal(await cmd(c, "refresh"), "String OK"); - await sleep(1000); + const again = await waitFor( + c, + async () => { + const a = await rowsAsked(c); + return a.length ? a : null; + }, + { timeout: 5000, interval: 100 }, + ); + await sleep(300); assert.deepEqual( - (await rowsAsked(c)).map((a) => a.start), + [...(again ?? []), ...(await rowsAsked(c))].map((a) => a.start), [0, 128], ); - assert.equal((await painted(c))["0"]?.["3"]?.tick, true); + assert.ok( + await waitFor(c, async () => (await painted(c))["0"]?.["3"]?.tick === true, { timeout: 3000, interval: 200 }), + ); }); test("onGetRows returning without Resolve fails the page at once, and it is asked again after 750 ms", async (t) => { @@ -688,10 +798,80 @@ scenario("The datasheet element in a tool window", (lane) => { await setReplies(c, { rows: "(timer)" }); const mark = await consoleMark(c); assert.equal(await cmd(c, "refresh"), "String OK"); - await sleep(2500); - t.diagnostic(`lines: ${JSON.stringify(await probeLines(c, mark))}`); + // Both pages asked for, and both answered by the timer after the handlers returned: the + // counts of its "timer resolved " lines add up to 2. + const resolved = (l) => + l.filter((x) => x.startsWith("timer resolved ")).reduce((s, x) => s + Number(x.slice(15)), 0); + const lines = + (await waitFor( + c, + async () => { + const l = await probeLines(c, mark); + return resolved(l) >= 2 ? l : null; + }, + { timeout: 5000, interval: 100 }, + )) ?? (await probeLines(c, mark)); + t.diagnostic(`lines: ${JSON.stringify(lines)}`); + assert.ok(lines.includes("rows 0-128") && lines.includes("rows 128-256"), JSON.stringify(lines)); + assert.equal(resolved(lines), 2, JSON.stringify(lines)); assert.equal(await state(c), "ready"); - assert.equal((await painted(c))["0"]?.["3"]?.tick, true); + assert.ok( + await waitFor(c, async () => (await painted(c))["0"]?.["3"]?.tick === true, { timeout: 3000, interval: 200 }), + ); + }); + + // The theme switched through the Window > Theme list, as menus.test.mjs does; the IDE runs with + // --no-save-ide-settings, so the choice is not saved. + async function chooseTheme(label) { + await c.evaluate(`executeIdeCommand("tbThemes_ShowList")`); + const at = await waitFor( + c, + () => + c.evaluate(`(() => { + const l = ${JSON.stringify(label)}; + const it = [...document.querySelectorAll("#contextMenu > *")].find((e) => { const t = e.innerText.trim(); return t === l || t.startsWith(l + " ("); }); + if (!it) return null; + const q = it.getBoundingClientRect(); + return q.width ? { x: q.x + q.width / 2, y: q.y + q.height / 2 } : null; + })()`), + { timeout: 3000, interval: 100 }, + ); + assert.ok(at, `the theme list has no item ${label}`); + await press(c, at); + assert.ok( + await waitFor(c, async () => (await c.evaluate("getThemeName()")) === label.toLowerCase(), { timeout: 5000 }), + `the theme is not ${label}`, + ); + await c.evaluate("try { hideContextMenu() } catch {}"); + await sleep(500); + } + + // The colours the grid paints with, and the --themeAddin* values its root computes. + const GRID_COLOURS_JS = `(() => { const g = ${GRID}; const p = g.properties; const r = ${CTL}.getRootElement(); + const cs = getComputedStyle(r); + return { theme: getThemeName(), back: p.backgroundColor, color: p.color, header: p.columnHeaderBackgroundColor, + rootBack: cs.getPropertyValue("--themeAddinBackColor").trim(), + rootControl: cs.getPropertyValue("--themeAddinControlBackColor").trim() }; })()`; + + // An IDE defect, toolwindow-addin-colours-stale: the tool window's body keeps the --themeAddin* + // values of the theme it was made in, so the grid, which reads them, keeps Dark's colours. + test("a theme change: a grid in a tool window keeps the colours of the theme the window was made in", async (t) => { + const colours = () => c.evaluate(GRID_COLOURS_JS); + const dark = await colours(); + assert.deepEqual(dark, { + theme: "dark", + back: "#494343", + color: "#e0dede", + header: "#423e3e", + rootBack: "#2b2b2b", + rootControl: "#575050", + }); + await chooseTheme("Light"); + await sleep(500); + const light = await colours(); + await chooseTheme("Dark"); + t.diagnostic(JSON.stringify(light)); + assert.deepEqual(light, { ...dark, theme: "light" }); }); test("nothing else threw in the page", () => { diff --git a/test/addin/designers.test.mjs b/test/addin/designers.test.mjs index 5bd0e8dbd..e24b5fcd6 100644 --- a/test/addin/designers.test.mjs +++ b/test/addin/designers.test.mjs @@ -34,8 +34,15 @@ const SRC = (name) => `/DesignersHost/Sources/${name}`; // What the probe printed since a mark, without its prefix, its counter and the number of the // designer instance ("Probe Default#3" is "Probe Default#"). The counter is in the order the // lines were printed, which is the console's order. +// The add-in's first line names the build, Host.CompilerVersion: it reads "loaded " here, +// so that a new build fails only the test that checks the version (menus.test.mjs). const probeLines = async (c, mark) => - (await linesSince(c, mark, { prefix: "[DesignersProbe] " })).map((l) => l.replace(/^\d+ /, "").replace(/#\d+/, "#")); + (await linesSince(c, mark, { prefix: "[DesignersProbe] " })).map((l) => + l + .replace(/^\d+ /, "") + .replace(/#\d+/, "#") + .replace(/^loaded 0\.15\.\d+$/, "loaded "), + ); // The lines a designer prints in OnAttached, for one whose GetURI is `uri`. const ATTACHED = (d, uri) => [ @@ -153,7 +160,11 @@ scenario("The custom-designer API of BETA 1045", (lane) => { const t = await waitFor(c, async () => (await tab(name))?.close ?? null, { timeout: 10 * 1000 }); assert.ok(t, `the tab ${name} has no close icon: ${J(await tab(name))}`); await kit.clickAt(t.x, t.y); - await sleep(700); + // Either the IDE asks about the changes, or the tab goes. + await waitFor(c, async () => (await kit.questions()).length > 0 || (await tab(name)) === null, { + timeout: 5000, + interval: 100, + }); const asked = await kit.questions(); if (asked.length) { assert.ok(reply, `closing ${name} asked ${J(asked)}`); @@ -210,7 +221,7 @@ scenario("The custom-designer API of BETA 1045", (lane) => { const names = (await loadedAddins(c)).map((a) => a.name); assert.ok(names.includes("DesignersProbe AddIn"), `loaded: ${J(names)}`); const lines = await waitLine(null, /^ready$/); - assert.deepEqual(lines, ["loaded 0.15.1045", ...REGISTERED, "ready"]); + assert.deepEqual(lines, ["loaded ", ...REGISTERED, "ready"]); }); test("Register: the page keeps each registration as given, the extension unchanged and the IconData as base64", async () => { @@ -392,7 +403,14 @@ scenario("The custom-designer API of BETA 1045", (lane) => { "Probe Default# activated", "Probe Default# data n=5 hex=5550504552", ]); - await closeTab("UPPER.PRB"); + // A tab whose bytes were never changed closes as one whose bytes were put back does. + const closing = await consoleMark(c); + assert.equal(await closeTab("UPPER.PRB"), null); + assert.deepEqual(await settled(closing), [ + "Probe Default# closing", + "Probe Default# deactivated", + "Probe Default# closed", + ]); // Only ".*", not a default, matches Other.xyz: the text editor opens it. assert.deepEqual(await openByDoubleClick("Other.xyz"), []); assert.equal((await selected()).type, "TextEditor"); @@ -459,7 +477,7 @@ scenario("The custom-designer API of BETA 1045", (lane) => { const mark = await consoleMark(c); await lane.restartCompiler(); assert.deepEqual(await settled(mark), [ - "loaded 0.15.1045", + "loaded ", ...REGISTERED, "ready", "create Probe Default", @@ -499,7 +517,7 @@ scenario("The custom-designer API of BETA 1045", (lane) => { } test("Unregister ends the compiler with an access violation, for a registered extension or not, with an error handler or not", async (t) => { - for (const mode of ["resume .prb", "plain .zzz"]) { + for (const mode of ["resume .prb", "plain .prb", "resume .zzz", "plain .zzz"]) { const r = await unregisterRun(mode); const [how, ext] = mode.split(" "); t.diagnostic(`${mode}: ${r.opened}`); diff --git a/test/addin/menus.test.mjs b/test/addin/menus.test.mjs index 14939df93..d104059d6 100644 --- a/test/addin/menus.test.mjs +++ b/test/addin/menus.test.mjs @@ -1,6 +1,5 @@ // The Menus, ProjectExplorer and theme-colour features of tbIDE new in BETA 1045, measured rather -// than read off the IDE's code (.claude/beta1045/facts-host.md, "Needs a probe" 9, 11 to 15, 17 -// and 19). The MenusProbe add-in (probes/menus) adds entries to the Project Explorer's file-view +// than read off the IDE's code. The MenusProbe add-in (probes/menus) adds entries to the Project Explorer's file-view // context menu and the File menu, two custom menu-bar menus (ProbeFirst as its very first menu // call, ProbeAfter after entries elsewhere) and an invisible one for ShowPopup; its toolbar // buttons change and remove entries, print SelectedItemPath, call AddFileUI and open tool windows @@ -8,15 +7,17 @@ // returns tbIDE's UnsupportedHostAddin. The project opened is probes/menus-host, which has a folder // inside Sources and two beside it. // -// Input is real input: menus are opened with real clicks and right clicks and read from the page's -// DOM (#contextMenu, #contextMenuSUB, the menu bar). Themes are switched through the Window > -// Theme list, as test/ide/customising.test.mjs does; the IDE runs with --no-save-ide-settings, so -// the choice is not saved. Neither add-in calls SaveSetting. +// Menus are opened with real clicks and right clicks and read from the page's DOM (#contextMenu, +// #contextMenuSUB, the menu bar). The theme list is opened with its command, tbThemes_ShowList, +// and a theme in it chosen with a real click, as test/ide/customising.test.mjs does; the IDE runs +// with --no-save-ide-settings, so the choice is not saved. Neither add-in calls SaveSetting. // // Each test states what BETA 1045 does. If one fails after an IDE update, the IDE has changed: // update the tbIDE pages that rest on it (docs/Reference/Built-In/tbIDE/Menus.md, Menu.md, -// MenuEntry.md, ProjectExplorer.md, Themes.md, AddIn.md) and docs/IDE/Customising/Themes.md, and -// then this file. +// MenuEntry.md, ProjectExplorer.md, Themes.md, AddIn.md) and docs/IDE/Customising/Themes.md, then +// the steps of the reproducers that name a test here (bugs/*/repro.json with "addin:menus"), and +// then this file. A test whose comment names an IDE defect asserts the defect: it fails once it +// is fixed. // // Run it with addin-test.bat, which gives it a lane; on its own it is skipped. @@ -258,11 +259,16 @@ scenario("tbIDE Menus, ProjectExplorer and theme colours (BETA 1045)", (lane) => test("UnsupportedHostAddin: listed with an empty name, drawn as a separator in the Add-Ins menu, and nothing in the console", async () => { const all = await linesSince(c, null); - // The only console line about it is the probe's own: no load failure. + // Its only console line is its own, and no line reports an add-in that failed or a load + // error, whether or not it names the DLL. assert.deepEqual( all.filter((l) => /UnsupportedProbe/i.test(l)), ["[UnsupportedProbe] returning UnsupportedHostAddin"], ); + assert.deepEqual( + all.filter((l) => /fail|error|entry point|addin|add-in/i.test(l) && !/^\[(Menus|Unsupported)Probe\] /.test(l)), + [], + ); await clickBar("Add-Ins"); assert.deepEqual(await texts(), ["---", "MenusProbe AddIn"]); await closeMenus(); @@ -319,6 +325,13 @@ scenario("tbIDE Menus, ProjectExplorer and theme colours (BETA 1045)", (lane) => assert.equal(item("P checked").icon, 'url("data:image;base64,iVBORw0KGgoAAAANS'); assert.equal(item("P icon").icon, 'url("data:image/svg+xml;base64,PHN2ZyB4b'); assert.deepEqual(await lines(mark), ["beforeshow 1"]); + // Enabled = False: a click on the entry sends no Click. + const m1 = await consoleMark(c); + const disabled = item("P disabled"); + await clickAt(c, disabled.x, disabled.y); + await sleep(1000); + assert.deepEqual(await lines(m1), []); + if (!(await menuOpen())) await openRowMenu(PE_FILE); const m2 = await consoleMark(c); await pick("P after Open 0"); assert.ok(await waitLine(m2, /^click after open 0$/), J(await lines(m2))); @@ -346,14 +359,12 @@ scenario("tbIDE Menus, ProjectExplorer and theme colours (BETA 1045)", (lane) => assert.deepEqual(await texts(true), ["P child 1", "P child 2"]); // A child's BeforeShow fires when its submenu opens. assert.deepEqual(await lines(mark), ["beforeshow 2", "beforeshow child 2"]); - // A click on the entry that holds the submenu sends no Click, and the menu stays open. + // A click on the entry that holds the submenu sends no Click, and the menu stays open; the + // child's BeforeShow fires again. const m2 = await consoleMark(c); await pick("P submenu"); await sleep(1000); - assert.deepEqual( - (await lines(m2)).filter((l) => l.startsWith("click")), - [], - ); + assert.deepEqual(await lines(m2), ["beforeshow child 2"]); assert.equal(await menuOpen(), true); if (!(await texts(true)).length) { await hover("P submenu"); @@ -397,7 +408,7 @@ scenario("tbIDE Menus, ProjectExplorer and theme colours (BETA 1045)", (lane) => await closeMenus(); // ProbeAfter opens with its entry, whose Click fires. await clickBar("ProbeAfter"); - assert.equal(await menuOpen(), true); + assert.ok(await waitFor(c, menuOpen, { timeout: 3000, interval: 100 }), "ProbeAfter did not open"); assert.deepEqual(await texts(), ["After item"]); mark = await consoleMark(c); await pick("After item"); @@ -497,6 +508,11 @@ scenario("tbIDE Menus, ProjectExplorer and theme colours (BETA 1045)", (lane) => return { mark, box }; } const read = (p) => c.evaluate(READ_JS(p), { awaitPromise: true }); + // The names in a folder of the project, as the page holds them. + const folder = (p) => + c.evaluate( + `(() => { const n = fs.tree.resolvePath("twinbasic:" + ${J(p)}); return n ? Object.keys(n.entries || {}).sort() : null; })()`, + ); test("AddFileUI: the name box; Enter returns the new file's path without twinbasic:, and Escape, an empty name and an invalid one return an empty string rather than raise an error", async () => { const inner = `${P}/Sources/Inner`; @@ -511,18 +527,28 @@ scenario("tbIDE Menus, ProjectExplorer and theme colours (BETA 1045)", (lane) => await pressKey(c, "Escape"); assert.equal(await waitLine(mark, /^addfile/), "addfile ok <>"); assert.equal(await read(`${inner}/MyFile2.prb`), null); - // An empty name. + // An empty name, and an invalid one, which the IDE says so of: each returns "" and makes no + // file anywhere in the project's folders. + const tree = async () => ({ + inner: await folder(inner), + sources: await folder(`${P}/Sources`), + root: await folder(P), + }); + const t0 = await tree(); + // The page keys a folder's entries in lower case. + assert.ok(t0.inner?.includes("myfile.prb"), J(t0)); ({ mark } = await startAddFile(`${inner}/Inner.twin`)); await pressKey(c, "a", { ctrl: true }); await pressKey(c, "Backspace"); await pressKey(c, "Enter"); assert.equal(await waitLine(mark, /^addfile/), "addfile ok <>"); - // An invalid name: the IDE says so, and the call returns "". + assert.deepEqual(await tree(), t0); ({ mark } = await startAddFile(`${inner}/Inner.twin`)); await typeText(c, "bad\\name"); await pressKey(c, "Enter"); assert.equal(await waitLine(mark, /^addfile/), "addfile ok <>"); assert.ok((await c.evaluate("window.__msg")).includes("Cannot create: the new name entered is invalid.")); + assert.deepEqual(await tree(), t0); // A name typed with the extension keeps one extension. ({ mark } = await startAddFile(`${inner}/Inner.twin`)); await pressKey(c, "a", { ctrl: true }); @@ -543,15 +569,18 @@ scenario("tbIDE Menus, ProjectExplorer and theme colours (BETA 1045)", (lane) => const DARK = ["#2b2b2b", "#494343", "#575050", "#666060", "#eeeeee", "#BCB5B5", "#AC947A", "#1F1B18"]; const LIGHT = ["#FFFFFF", "#F0F0F0", "#E1E4E6", "#C3CDDA", "#20232B", "#606A79", "#3E6FC1", "#FFFFFF"]; - test("--themeAddin*: a tool window keeps the colours of the theme it was made in; High Contrast Dark has Dark's", async () => { + // What the two tool windows hold after each switch, for the test after this one. + const seen = {}; + + test("--themeAddin*: the page's values follow the theme; OnChangedTheme gets its name in lower case; a tool window made now has the theme's values; High Contrast Dark has Dark's", async () => { const theme = (id) => c.evaluate(THEME_JS(id)); let s = await theme("MenusProbeWin"); assert.deepEqual([s.theme, s.root, s.inline, s.computed, s.box], ["dark", DARK, DARK, DARK, "rgb(43, 43, 43)"]); const mark = await consoleMark(c); await chooseTheme("Light"); s = await theme("MenusProbeWin"); - assert.deepEqual([s.theme, s.root, s.inline, s.computed, s.box], ["light", LIGHT, DARK, DARK, "rgb(43, 43, 43)"]); - // OnChangedTheme is told the theme's name in lower case. + seen.lightOld = s; + assert.deepEqual([s.theme, s.root], ["light", LIGHT]); assert.ok(await waitLine(mark, /^theme changed light$/), J(await lines(mark))); await button("MenusProbeShow2", /^shown MenusProbeWin2$/); s = await theme("MenusProbeWin2"); @@ -559,34 +588,58 @@ scenario("tbIDE Menus, ProjectExplorer and theme colours (BETA 1045)", (lane) => // Chosen from Light, so the values are not left over from the theme before. await chooseTheme("High Contrast Dark"); s = await theme("MenusProbeWin2"); - assert.deepEqual([s.theme, s.root, s.inline], ["high contrast dark", DARK, LIGHT]); + seen.hcNew = s; + assert.deepEqual([s.theme, s.root], ["high contrast dark", DARK]); await chooseTheme("Dark"); }); - test("Menus.RemoveAllAddedEntries changes nothing; a compiler restart drops every entry, the add-in adds its own again, and the dead ProbeFirst item stays", async () => { + // An IDE defect, toolwindow-addin-colours-stale. + test("--themeAddin*: a tool window keeps the values of the theme it was made in", () => { + assert.ok(seen.lightOld && seen.hcNew, "the test before this one did not switch the themes"); + // Made in Dark, after the switch to Light. + const s = seen.lightOld; + assert.deepEqual([s.inline, s.computed, s.box], [DARK, DARK, "rgb(43, 43, 43)"]); + // Made in Light, after the switch to High Contrast Dark. + assert.deepEqual(seen.hcNew.inline, LIGHT); + }); + + // An IDE defect, menus-removealladdedentries-noop. + test("Menus.RemoveAllAddedEntries changes nothing: the entries and the custom menus stay", async () => { const store = () => c.evaluate(STORE_JS); await button("MenusProbeLate", /^added late/); const before = await store(); + const barBefore = await bar(); + await openRowMenu(PE_FILE); + const peBefore = (await texts()).filter((t) => t.startsWith("P ")); + await closeMenus(); await button("MenusProbeRemoveAll", /^removed all/); await sleep(800); assert.deepEqual(await store(), before); + // The custom menus are still on the bar, each as it was. + assert.deepEqual(await bar(), barBefore); await clickBar("File"); assert.deepEqual( (await texts()).filter((t) => t.startsWith("P ")), ["P late"], ); await closeMenus(); + // The Project Explorer's entries are still there: only BeforeShow's caption changes with each opening. + await openRowMenu(PE_FILE); + const peAfter = (await texts()).filter((t) => t.startsWith("P ")); + await closeMenus(); + const plain = (l) => + l.map((t) => t.replace(/^P before show \d+$/, "P before show")).filter((t) => t !== "P toggled"); + assert.deepEqual(plain(peAfter), plain(peBefore)); + }); + + test("a compiler restart drops every entry, and the add-in adds its own again", async () => { const mark = await consoleMark(c); await lane.restartCompiler(); assert.ok(await waitLine(mark, /^loaded/, 30 * 1000), "the probe did not load again"); - await sleep(1000); - const b = (await bar()).filter((i) => i.shown).map((i) => i.text); - assert.deepEqual(b.slice(b.indexOf("Help"), b.indexOf("Help") + 4), [ - "Help", - "ProbeFirst", - "ProbeFirst", - "ProbeAfter", - ]); + assert.ok( + await waitFor(c, async () => (await bar()).some((i) => i.text === "ProbeAfter" && i.shown), { timeout: 5000 }), + J(await bar()), + ); await clickBar("File"); assert.deepEqual( (await texts()).filter((t) => t.startsWith("P ")), @@ -598,4 +651,25 @@ scenario("tbIDE Menus, ProjectExplorer and theme colours (BETA 1045)", (lane) => assert.ok(all.includes("P before show 1") && all.includes("P remove me"), J(all)); await closeMenus(); }); + + // An IDE defect, addcustom-first-menu-dead: the dead item is not dropped, and the new one is dead too. + test("after a compiler restart the dead ProbeFirst item stays beside the new one, which does not open either", async () => { + const b = (await bar()).filter((i) => i.shown).map((i) => i.text); + assert.deepEqual(b.slice(b.indexOf("Help"), b.indexOf("Help") + 4), [ + "Help", + "ProbeFirst", + "ProbeFirst", + "ProbeAfter", + ]); + const items = + await c.evaluate(`[...rootMenuFile.parentNode.children].filter((e) => e.innerText.trim() === "ProbeFirst") + .map((e) => { const q = e.getBoundingClientRect(); return { x: q.x + q.width / 2, y: q.y + q.height / 2 }; })`); + assert.equal(items.length, 2); + for (const p of items) { + await clickAt(c, p.x, p.y); + await sleep(800); + assert.equal(await menuOpen(), false); + await closeMenus(); + } + }); }); diff --git a/test/addin/probes/datasheet/Sources/MainModule.twin b/test/addin/probes/datasheet/Sources/MainModule.twin index 96bc9096a..b6dd288df 100644 --- a/test/addin/probes/datasheet/Sources/MainModule.twin +++ b/test/addin/probes/datasheet/Sources/MainModule.twin @@ -236,6 +236,7 @@ Private Class DatasheetProbeAddin Case "sorted": v = .controller.setColumnIsSorted(CLng(p(1)), CBool(p(2))) Case "filtered": v = .controller.setColumnIsFiltered(CLng(p(1)), CBool(p(2))) Case "nav": v = .controller.navigateToRecord(CLng(p(1))) + Case "navdouble": v = .controller.navigateToRecord(CDbl(Val(p(1)))) Case "selected": v = .controller.getSelectedRows() Case "selectall": v = .controller.selectAllRows() Case "flash": v = .controller.flashMessage(p(1), CLng(p(2))) diff --git a/test/example-projects/contributed-VBA_JSON/Settings b/test/example-projects/contributed-VBA_JSON/Settings index 6e348dc9f..474a07e79 100644 --- a/test/example-projects/contributed-VBA_JSON/Settings +++ b/test/example-projects/contributed-VBA_JSON/Settings @@ -58,7 +58,7 @@ "versionBuild": "1", "versionMajor": "2", "versionMinor": "3", - "versionRevision": "1" + "versionRevision": "2" } ], "project.settingsVersion": 1, diff --git a/test/example-projects/contributed-tbFileSysTools/Settings b/test/example-projects/contributed-tbFileSysTools/Settings index de27c99cf..76136efcb 100644 --- a/test/example-projects/contributed-tbFileSysTools/Settings +++ b/test/example-projects/contributed-tbFileSysTools/Settings @@ -56,8 +56,8 @@ "path64": "/Packages/tbFileSysTools", "symbolId": "tbFileSysTools", "versionBuild": "0", - "versionMajor": "1", - "versionMinor": "9", + "versionMajor": "2", + "versionMinor": "0", "versionRevision": "0" } ], diff --git a/test/package-tests/VBA_JSON/Sources/RunAll.twin b/test/package-tests/VBA_JSON/Sources/RunAll.twin index 230178d0e..629ae3af5 100644 --- a/test/package-tests/VBA_JSON/Sources/RunAll.twin +++ b/test/package-tests/VBA_JSON/Sources/RunAll.twin @@ -1,11 +1,11 @@ ' Generated by scripts/package_tests.mjs from this project's [TestCase] Subs and expect.json: ' do not edit. Run Sub Main: each case prints PASS, FAIL or SKIP in the DEBUG CONSOLE. -' The cases are written for the package VBA_JSON, version 2.3.1.1. Each one checks what is +' The cases are written for the package VBA_JSON, version 2.3.2.1. Each one checks what is ' correct, so a case that fails names a defect of the package. Module RunAll Public Sub Main() - Expect.StartRun "VBA_JSON 2.3.1.1: 126 test cases" + Expect.StartRun "VBA_JSON 2.3.2.1: 126 test cases" On Error Resume Next Expect.StartCase Err.Clear @@ -503,8 +503,8 @@ Module RunAll Err.Clear ParseJsonTests.EmptyKey_IsAKey Expect.EndCase "ParseJsonTests.EmptyKey_IsAKey", Err.Number, Err.Description - Expect.Skip "ParseJsonTests.Error_ArrayThatIsNotClosed_Raises10001", "it does not return in version 2.3.1.1" - Expect.Skip "ParseJsonTests.Error_StringInAnArrayThatIsNotClosed_Raises10001", "it does not return in version 2.3.1.1" + Expect.Skip "ParseJsonTests.Error_ArrayThatIsNotClosed_Raises10001", "it does not return in version 2.3.2.1" + Expect.Skip "ParseJsonTests.Error_StringInAnArrayThatIsNotClosed_Raises10001", "it does not return in version 2.3.2.1" On Error GoTo 0 Expect.EndRun End Sub diff --git a/test/package-tests/VBA_JSON/expect.json b/test/package-tests/VBA_JSON/expect.json index fba8eb97f..728b11ef7 100644 --- a/test/package-tests/VBA_JSON/expect.json +++ b/test/package-tests/VBA_JSON/expect.json @@ -1,5 +1,5 @@ { - "version": "2.3.1.1", + "version": "2.3.2.1", "cases": { "ConvertToJsonTests.String_ThatIsNotANumber_IsQuoted": { "fails": "3 of 3 checks failed: 16 letters E: expected \"\"EEEEEEEEEEEEEEEE\"\", got \"EEEEEEEEEEEEEEEE\"; 16 periods: expected \"\"................\"\", got \"................\"; 16 digits with leading zeros (not a JSON number): expected \"\"0000123456789012\"\", got \"0000123456789012\"" @@ -49,14 +49,11 @@ "DatesTests.ConvertToJson_DateBefore1601_Raises10014": { "fails": "1 of 1 checks failed: run-time error of ConvertToJson(1 January 1500): expected 10014, got 0" }, - "DictionaryTests.Item_KeysThatDifferInCase_AreSeparateKeys": { - "fails": "2 of 3 checks failed: number of keys after d(\"a\") = 1 and d(\"A\") = 2: expected 2, got 1; d(\"a\") after d(\"A\") = 2: expected 1, got 2" - }, "ParseJsonTests.Strings_NewlineEscape_IsALineFeed": { "fails": "1 of 1 checks failed: ParseJson of the string a\\nb (U+000A is one line feed): expected \"ab\", got \"ab\"" }, - "ParseJsonTests.KeysThatDifferInCase_AreSeparateEntries": { - "fails": "2 of 3 checks failed: number of keys of {\"id\":1,\"ID\":2}: expected 2, got 1; r(\"id\"): expected 1, got 2" + "ParseJsonTests.EmptyKey_IsAKey": { + "fails": "(runtime error 5: Invalid procedure call or argument)" }, "ParseJsonTests.Error_ArrayThatIsNotClosed_Raises10001": { "hangs": true diff --git a/test/package-tests/tbFileSysTools/Sources/RunAll.twin b/test/package-tests/tbFileSysTools/Sources/RunAll.twin index 51ce63690..01c65919f 100644 --- a/test/package-tests/tbFileSysTools/Sources/RunAll.twin +++ b/test/package-tests/tbFileSysTools/Sources/RunAll.twin @@ -1,11 +1,11 @@ ' Generated by scripts/package_tests.mjs from this project's [TestCase] Subs and expect.json: ' do not edit. Run Sub Main: each case prints PASS, FAIL or SKIP in the DEBUG CONSOLE. -' The cases are written for the package tbFileSysTools, version 1.9.0.0. Each one checks what is +' The cases are written for the package tbFileSysTools, version 2.0.0.0. Each one checks what is ' correct, so a case that fails names a defect of the package. Module RunAll Public Sub Main() - Expect.StartRun "tbFileSysTools 1.9.0.0: 72 test cases" + Expect.StartRun "tbFileSysTools 2.0.0.0: 72 test cases" On Error Resume Next Expect.StartCase Err.Clear diff --git a/test/package-tests/tbFileSysTools/expect.json b/test/package-tests/tbFileSysTools/expect.json index 4dfd3e029..0551b706f 100644 --- a/test/package-tests/tbFileSysTools/expect.json +++ b/test/package-tests/tbFileSysTools/expect.json @@ -1,77 +1,4 @@ { - "version": "1.9.0.0", - "cases": { - "AttributeTests.FileSetAttribute_NoAttributes_SetsHidden": { - "fails": "2 of 3 checks failed: File.SetAttribute faHidden, True on a file with no attributes sets Hidden: expected True, got False; Attributes of that file after SetAttribute faHidden, True: expected 2, got 128" - }, - "AttributeTests.FileSetAttribute_NoAttributes_SetsReadOnly": { - "fails": "2 of 2 checks failed: File.SetAttribute faReadOnly, True on a file with no attributes sets ReadOnly: expected True, got False; Attributes of that file after SetAttribute faReadOnly, True: expected 1, got 128" - }, - "ErrorNumberTests.TextFileToString_ExclusiveFile_Raises70": { - "fails": "1 of 1 checks failed: TextFileToString of a file held open with exclusive access raises: expected 70, got -2147467259" - }, - "ErrorNumberTests.GetFileEncoding_ExclusiveFile_Raises70": { - "fails": "1 of 1 checks failed: GetFileEncoding of a file held open with exclusive access raises: expected 70, got -2147467259" - }, - "ErrorNumberTests.GetFileLineEnding_ExclusiveFile_Raises70": { - "fails": "1 of 1 checks failed: GetFileLineEnding of a file held open with exclusive access raises: expected 70, got -2147467259" - }, - "ErrorNumberTests.ReadStream_ExclusiveFile_Raises70": { - "fails": "1 of 1 checks failed: ReadStream of a file held open with exclusive access raises: expected 70, got -2147467259" - }, - "ErrorNumberTests.TextFileToArray_ExclusiveFile_Raises70": { - "fails": "1 of 1 checks failed: TextFileToArray of a file held open with exclusive access raises: expected 70, got -2147467259" - }, - "ErrorNumberTests.FileContainsText_ExclusiveFile_Raises70": { - "fails": "1 of 1 checks failed: FileContainsText of a file held open with exclusive access raises: expected 70, got -2147467259" - }, - "ErrorNumberTests.CreateFolder_ReservedName_Raises52": { - "fails": "2 of 2 checks failed: CreateFolder of the folder name con raises: expected 52, got 75; CreateFolder of the folder name nul raises: expected 52, got 76" - }, - "ErrorNumberTests.MoveFile_ReservedName_Raises52": { - "fails": "2 of 2 checks failed: MoveFile to the file name con raises: expected 52, got 75; MoveFile to the file name nul raises: expected 52, got 0" - }, - "ErrorNumberTests.MoveFolder_ReservedName_Raises52": { - "fails": "2 of 3 checks failed: MoveFolder to the folder name con raises: expected 52, got 75; MoveFolder to the folder name nul raises: expected 52, got 70" - }, - "ErrorNumberTests.MoveFile_NulDevice_KeepsSourceFile": { - "fails": "6 of 6 checks failed: MoveFile to the file name nul raises: expected 52, got 0; the source file is still there after MoveFile to the file name nul: expected True, got False; MoveFile to the file name NUL raises: expected 52, got 0; the source file is still there after MoveFile to the file name NUL: expected True, got False; MoveFile to the file name nul.txt raises: expected 52, got 0; the source file is still there after MoveFile to the file name nul.txt: expected True, got False" - }, - "ErrorNumberTests.FileMove_NulDevice_KeepsSourceFile": { - "fails": "2 of 2 checks failed: File.Move to the file name nul raises: expected 52, got 53; the source file is still there after File.Move to the file name nul: expected True, got False" - }, - "ErrorNumberTests.FileSystemObjectMoveFile_NulDevice_KeepsSourceFile": { - "fails": "2 of 2 checks failed: FileSystemObject.MoveFile to the file name nul raises: expected 52, got 0; the source file is still there after FileSystemObject.MoveFile to the file name nul: expected True, got False" - }, - "ErrorNumberTests.Rename_ReservedName_Raises52": { - "fails": "2 of 3 checks failed: Rename of a file to the name con raises: expected 52, got 5; Rename of a file to the name nul raises: expected 52, got 5" - }, - "LongPathTests.FolderFiles_Path258_ListsFiles": { - "fails": "2 of 2 checks failed: Folder.Files of a folder whose path has 258 characters raises error: expected 0, got 76; files in Folder.Files of that folder: expected 1, got 0" - }, - "LongPathTests.FolderFiles_Path270_ListsFiles": { - "fails": "2 of 2 checks failed: Folder.Files of a folder whose path has 270 characters raises error: expected 0, got 76; files in Folder.Files of that folder: expected 1, got 0" - }, - "LongPathTests.FolderSubFolders_Path258_ListsFolders": { - "fails": "2 of 2 checks failed: Folder.SubFolders of a folder whose path has 258 characters raises error: expected 0, got 76; folders in Folder.SubFolders of that folder: expected 1, got 0" - }, - "LongPathTests.FolderSize_Path258_AddsFiles": { - "fails": "2 of 2 checks failed: Folder.Size of a folder whose path has 258 characters raises error: expected 0, got 76; Folder.Size of that folder: expected 5, got 0" - }, - "LongPathTests.FolderSize_SubfolderPath258_AddsFiles": { - "fails": "2 of 2 checks failed: Folder.Size of a folder with a subfolder whose path has 258 characters raises error: expected 0, got 76; Folder.Size of that folder: expected 5, got 0" - }, - "PathTests.GetRelativePath_Base259": { - "fails": "1 of 1 checks failed: GetRelativePath of a target below a base of 259 characters: expected \"x\\y.txt\", got \"..\\\\x\\y.txt\"" - }, - "PathTests.GetRelativePath_Base260": { - "fails": "1 of 1 checks failed: GetRelativePath of a target below a base of 260 characters: expected \"x\\y.txt\", got \"..\\\\x\\y.txt\"" - }, - "PathTests.GetRelativePath_Base264": { - "fails": "1 of 1 checks failed: GetRelativePath of a target below a base of 264 characters: expected \"x\\y.txt\", got \"..\\\\x\\y.txt\"" - }, - "PathTests.GetRelativePath_Base300": { - "fails": "1 of 1 checks failed: GetRelativePath of a target below a base of 300 characters: expected \"x\\y.txt\", got \"..\\\\x\\y.txt\"" - } - } + "version": "2.0.0.0", + "cases": {} } diff --git a/test/shots/manifest.json b/test/shots/manifest.json index be119c0f4..b5ac1e475 100644 --- a/test/shots/manifest.json +++ b/test/shots/manifest.json @@ -1,6 +1,21 @@ { "format": 1, "pictures": { + "Documentation/Images/confirm-merge.light.png": { + "png": { + "decision": { + "keep": "new", + "capture": "ca9d47768c6993891413a22b8b8507977cd56bcd" + } + }, + "svg": { + "decision": { + "accept": true, + "svg": "d5223fe9e030fc3437f0571c2608d55f3462318d", + "png": "ca9d47768c6993891413a22b8b8507977cd56bcd" + } + } + }, "Features/Images/017bd6f8-4b35-43a9-b6be-84cba69daf64.png": { "build": 1034 }, @@ -836,6 +851,12 @@ "Reference/Built-In/tbIDE/Images/DebugConsole_PrintText.png": { "build": 1042 }, + "Reference/Built-In/tbIDE/Images/Restart_Without_Addins.light.png": { + "build": 1045 + }, + "Reference/Built-In/tbIDE/Images/Restart_Without_Addins.png": { + "build": 1045 + }, "Reference/Built-In/tbIDE/Images/Sample10.light.png": { "build": 1042 },