You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9a9ea86
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: WIP.ExamplesBuild.md
+45Lines changed: 45 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -290,6 +290,39 @@ already consumes. Two exist:
290
290
|---|---|---|
291
291
|`console`| stdole, VB (Forms), AppGlobalClassObject | everything by default |
292
292
|`packages`| the above plus all eleven other shipped packages |`Reference/Built-In/` and the package tutorials |
293
+
|`form`|`console`, a delta | a `check_run` sample that needs a real form: drawing, `Cls`, `Print`, `Scale`, a form property. Never inferred: a fence says `project=form`|
294
+
295
+
(The table is the two whole templates. The deltas over them --- `vb-private`, `cc-private`,
296
+
`wnc-private`, `cef-private`, `implicit`, `cef`, `webview2` --- are `TEMPLATE_BASE` in
297
+
`scripts/lib/example-batches.mjs`, with `form`.)
298
+
299
+
**`form` is `console` plus a real `Form1`**: `Sources/Form1.twin` (a predeclared class with the
300
+
`FormDesignerId` attribute) and `Sources/Form1.tbform` (its designer file), and its own
301
+
`tbxStage.twin`, which is console's less the line `Public Form1 As Form`. A form made with
302
+
`New Form` in code has no designer file and cannot be drawn on (`Load` raises 361, `AutoRedraw`
303
+
raises -2147467259), so the form has to be a file of the project. Four facts about it, all
304
+
measured on BETA 995:
305
+
306
+
-**An empty form has no `_children` key.**`"_children": []` in `Form1.tbform` fails the build with
307
+
`TB5247 unable to find matching form designer JSON via FormDesignerId`, and `Form1` is then
308
+
unrecognised everywhere.
309
+
-**The stand-in makes no difference to `Load Form1`.** With `Public Form1 As Form` in the stage
310
+
beside a real `Form1` class, `Form1` reaches the class's predeclared instance
311
+
(`TypeName(Form1)` is `Form1`, `Load Form1` and `AutoRedraw` work), and the stand-in stays
312
+
`Nothing`. In the `console` template, with no class, `Form1` is the stand-in and is `Nothing` at
313
+
run time. The `form` stage drops the line anyway, so that no second `Form1` exists at project
314
+
scope. A probe holds the two stage sets to "console's less that line", which is the only
315
+
thing that keeps the lists from drifting apart.
316
+
-**Fences for `form` go in a run project of their own.** Batches are grouped by template, so a
317
+
`project=form` run fence is never packed with a `console` one; a `projname=` group whose fences
318
+
all say `project=form` is one form project (`checkGroups` refuses a group of two templates, so
319
+
the `slot=file` module fence that declares `GetPixel` says `project=form` too).
320
+
-**The dispatcher unloads every form each sample leaves loaded.** A loaded form ends the
321
+
run with `[DEBUGGER] Waiting for remaining forms to close...` and keeps it waiting, and the next
322
+
sample finds the form with what the last one drew (a second sample's `GetPixel` on a form the
323
+
first had drawn on read red before it drew anything). `tbxRun` therefore calls `tbxUnloadForms`
324
+
after each sample and before its end marker; a sample that forgets `Unload Form1` costs nothing,
325
+
and the samples share no form. The VB6 harness does the same.
293
326
294
327
**`project.references` is a plain JSON array, and a hand-written entry works.** Measured:
295
328
an entry composed by hand from a package's own `Settings` --- id, name, version,
@@ -429,6 +462,18 @@ less two; and `Err.Source` of an error raised in the exe is the project name, wh
429
462
`ErrObject/Raise.md` differs. `Close` with no argument in a sample also closes the file the
430
463
output goes to, so the sample's next `Debug.Print` raises error 52.
431
464
465
+
**A `project=form` fence is built in VB6 with a blank `Form1.frm`.** The project then has a
466
+
`Form=Form1.frm` line and no `Unattended=-1`, which VB6 refuses for a project with a form, so
467
+
its exe is run on a private desktop (`runOnDesktop`, as a reproducer's is) and the time limit ends
468
+
one that waits on a box. A `projname=` group takes the form when any of its fences says
469
+
`project=form`; plain fences that say it are one project of their own. The harness unloads each
470
+
sample's forms before the end marker, as the twinBASIC dispatcher does, because a loaded form keeps a
471
+
VB6 exe running after `Main` returns. `Declare PtrSafe` is not VB6: `declaresForVb6` drops `PtrSafe`
472
+
and reads `LongPtr` as `Long` on a Declare statement's lines (and its continuations) and touches
473
+
nothing else, which is what lets the documentation's `GetPixel` module build. Checked on BETA 995
474
+
and in VB6: both form samples print what the pages say (`Graphics-Methods.md`'s three lines, and
475
+
the Form page's `True`).
476
+
432
477
Two things a batch runner must do that a single-fence runner need not:
433
478
434
479
-**Keep a source map.** Errors return against a generated file and line; the report names
Copy file name to clipboardExpand all lines: WIP.HelpAddin.md
+16-11Lines changed: 16 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ tests IDE add-ins by machine, which the add-in is developed against.
6
6
7
7
**Status: Stages 1 and 2 are done, and Stage 3's index is built** --- `addin-test.bat`
8
8
operates Samples 10 and 15 end to end and leaves the registry as it found it; all fourteen
9
-
of Stage 2's questions are answered, twelve of them by eight probe lanes that fail when a
9
+
of Stage 2's questions are answered, thirteen of them by nine probe lanes that fail when a
10
10
later IDE build behaves differently; and every build publishes `tB/symbols.json`, 5,536
11
11
names at 4,086 URLs, under a drift guard that fails the build when one of its URLs goes.
12
12
Stage 3's embedded mode, a `theme` parameter the site would read, waits until the add-in
@@ -630,12 +630,16 @@ Everything after this stage is developed against it.
630
630
read as one. `PrintText` stores its text escaped (`<b>` as `<b>`), so a URL comes
631
631
back exactly as printed, `&` included.
632
632
633
-
**The probe stayed in scratch.** It was thirty lines: `Host_OnProjectLoaded` printing
634
-
`Environ$("TB_ADDIN_TEST")`, the same through `GetEnvironmentVariableW`, and its own process
635
-
id. What it measured matters only while the add-in depends on it, and the add-in checks it
636
-
itself from Stage 4 on (increment 1 below). `add-in/` holds the add-in's tree and nothing
637
-
else: `stageProject` copies the whole folder it is given and packs the copy, so a probe
638
-
kept inside it would be packed into the add-in's project.
633
+
**The probe is a lane.** It was thirty lines in scratch at first (`Host_OnProjectLoaded`
634
+
printing `Environ$("TB_ADDIN_TEST")`, the same through `GetEnvironmentVariableW`, and its
635
+
own process id), and nothing guarded the answer although the rule above depends on it.
636
+
It is now [test/addin/probes/env](test/addin/probes/env) with
637
+
[env.test.mjs](test/addin/env.test.mjs): the variable reads `1` both ways in the
638
+
compiler's process, again in the process a restart starts, and unset in an IDE started
639
+
without it. The add-in checks the variable itself from Stage 4 on (increment 1 below).
640
+
`add-in/` holds the add-in's tree and nothing else: `stageProject` copies the whole
641
+
folder it is given and packs the copy, so a probe kept inside it would be packed into
642
+
the add-in's project.
639
643
7.**A runner.** Scenarios in JavaScript under `node:test`, one IDE per test project, lanes
640
644
by `--port` as today. The add-in's pure twinBASIC logic --- word extraction, lookup --- is
641
645
tested without loading any add-in: a test project holds those modules and a
@@ -695,11 +699,12 @@ offline route, and [appdata.test.mjs](test/addin/appdata.test.mjs) (P6) the lane
695
699
`APPDATA` and the FAQ's answer on where add-ins go. [arch.test.mjs](test/addin/arch.test.mjs)
696
700
(P7) holds up the Add Ins page's account of which folder loads when, and the win64 builds
697
701
`buildAddin` now makes; [reload.test.mjs](test/addin/reload.test.mjs) (P8, P9) the account
698
-
of a compiler restart on the tbIDE package page and the ToolWindows page; and
702
+
of a compiler restart on the tbIDE package page and the ToolWindows page;
699
703
[entry.test.mjs](test/addin/entry.test.mjs) (P14) the entry point's NOTE on the tbIDE
700
-
package page. P9 turned up the shared id `""` of windows given none, and the test of it
704
+
package page; and [env.test.mjs](test/addin/env.test.mjs) (P10) the rule that an add-in under
705
+
test opens nothing, which reads `TB_ADDIN_TEST`. P9 turned up the shared id `""` of windows given none, and the test of it
701
706
went in the panes lane, with the rest of what a tool window does. A probe that settles a
702
-
question once, as P10's did, stays in scratch; so did the two P3 checks that need the
707
+
question once stays in scratch; so did the two P3 checks that need the
703
708
network or a changed WebView2, the live site in the frame and the colour scheme with
704
709
WebView2 preferring light.
705
710
@@ -714,7 +719,7 @@ WebView2 preferring light.
714
719
| P7 | Which bitness does the compiler start in, and does switching the build target restart it in the other one and load the other `addins` folder? **Answered, BETA 983 and 995: yes, and yes.** The target a project opens in picks the compiler --- win32 when the IDE remembers none, `twinBASIC_win64_noDEP.exe` for a project remembered as win64 --- and each compiler loads the folders of its own bitness alone, the install's and `%APPDATA%`'s. Switching the target of an open project restarts the compiler in the other bitness, and the new one loads the other folders: a 64-bit build of the probe in each win64 folder loaded, and ran 64-bit, once the project was switched to win64, and the 32-bit ones again after a switch back. | building and testing both bitnesses --- `buildAddin` builds either, and a shipped add-in needs both |
715
720
| P8 | Is a loaded add-in DLL locked against being overwritten? **Answered, BETA 983 and 995: yes.** While its IDE runs, overwriting fails (`EBUSY`) and deleting fails (`EPERM`), though renaming works; the hold outlasts the compiler's exit by a few tens of milliseconds. The P9 lane checks all three again. | the rebuild loop --- the DLL is built outside `addins`, and copied in once the IDE has ended, or renamed aside first (P9) |
716
721
| P9 | Does a compiler restart reload add-ins from disk? **Answered, BETA 983 and 995: yes.** A restart --- the restart button, a switch of build target, or the IDE's own after a crash --- removes every add-in's buttons and shortcuts, leaves its windows showing `(currently unavailable)`, kills the old compiler, so that no `Class_Terminate` runs, and starts a compiler that loads whatever file is in the folders then. With the loaded DLL renamed aside, a restart loaded nothing; with a new build put in its place, the next restart loaded it, about a second after the click, and it got its old windows back by their ids. | a rebuild loop without restarting the IDE --- it works: rename aside, copy in, restart |
717
-
| P10 | Does an environment variable set by the harness reach the add-in (`Environ$`)? **Answered, BETA 983: yes**, through the launcher, the IDE and the compiler the IDE starts. With `TB_ADDIN_TEST=1` in `launchIde`'s environment, `Environ$` and `GetEnvironmentVariableW` both returned `1` in the add-in, and a compiler started by the restart buttonreturned it too; left out, both said it was unset. `WEBVIEW2_USER_DATA_FOLDER`, which `launchIde` always sets, arrived with the lane's port in it. | the side-effect switch |
722
+
| P10 | Does an environment variable set by the harness reach the add-in (`Environ$`)? **Answered, BETA 983 and 995: yes**, through the launcher, the IDE and the compiler the IDE starts. With `TB_ADDIN_TEST=1` in `launchIde`'s environment, `Environ$` and `GetEnvironmentVariableW` both returned `1` in the add-in, whose process id was the compiler's, and a compiler started by the restart button, a new process, returned it too; left out, `Environ$` was empty and the Win32 call said unset. Held by [test/addin/env.test.mjs](test/addin/env.test.mjs). `WEBVIEW2_USER_DATA_FOLDER`, which `launchIde` always sets, arrived with the lane's port in it. | the side-effect switch |
718
723
| P11 | Does the IDE write into its own install folder during a session? **Answered, BETA 983 and 995: no.** On 983 a compile, a compiler crash and a `tbrun` build-and-run left all 233 files byte-identical, mtimes included. On 995 the install (235 files) was byte-identical after exports, a `tbbuild` and two `tbrun` runs; `%APPDATA%` was not re-checked. | hardlinks or copies --- copies, for safety, at 380 ms |
719
724
| P12 | Does `raiseEvent` from plain tool-window HTML throw? **Answered, BETA 983 and 995: yes** --- `TypeError: Cannot read properties of null (reading 'rootEventHandler')`, and the listener is not called. An inline handler that calls the listener `AddEventListener` stored on its parent, `this.parentNode.<name>(event)`, reaches the add-in. | how the pane's events are written |
720
725
| P13 | Does the compiler's HTTP server serve any file placed under `ide\`? **Answered, BETA 983 and 995: yes**, and it is the page server, `twinBASIC_win32.exe --ide=<pid>`, not the compiler. Any file, byte for byte, below the page's own path, including one written after the IDE started; a frame with a relative `src` shows it on the IDE page's own origin. A query string makes a 404, and `.html` has no `Content-Type`. | an offline route --- it exists ([Offline](#ways-to-show-a-page)) |
0 commit comments