tools/TestTableWriter/README.md
The Test Table Writer was written as a method to generate UI Automation tests for OpenConsole. UI Automation has a lot of corner cases, so we developed this workflow to simplify storing and updating these test cases (particularly revolving around movement).
UiaTests.csv:
GenerateTests.ps1
GenerateTests.ps1 will load UiaTests.csv and export the tests and any necessary variables to "src\interactivity\win32\ut_interactivity_win32\GeneratedUiaTextRangeMovementTests.g.cpp".clear; .\TE.exe /name:*UiaTextRangeTests*GeneratedMovementTests* .\Conhost.Interactivity.Win32.Unit.Tests.dll in PowerShellUiaTests.csv and GeneratedUiaTextRangeMovementTests.g.cpp. Be sure to run the code formatter.$(OutDir)/TE.exe$(TargetPath) /name:*uiatextrange*generated* /inprocThe text buffer is assumed to be partially filled. Specifically, the top half of the text buffer contains text, and each row is filled with 10 segments of alternating text. For visualization, the ascii diagram below shows what the text buffer may look like.
+------------------------------+
|1XX XXX X2X XXX XXX |
|XXX XXX XXX XXX XXX |
|XXX XXX X3X XXX XXX |
|XXX XXX XXX XXX XXX |
|XXX XXX X4X XXX XX5 |
|6 |
| |
| 7 |
| |
| 8|
+------------------------------+
9
The following positions are being tested:
origin: buffer originmidTop: middle of the top linemidHistory: middle of the historymidDocEnd: middle of the last line of textlastCharPos: last character in the bufferdocEnd: one past the last line of textmidEmptySpace: middle of the empty space in the bufferbufferEnd: end of the bufferendExclusive: exclusive end of the bufferThis is intended to provide adequate testing coverage for GH#6986.
Each position above already has a predefined variable name. However, a few heuristics are used to define new variables based on the standard variables above.
<name>Left: the left-most position on the same line as <name><name>P<number>C, <name>M<number>C:
<name>: start at the position of <name>P (or M): move forwards (aka "plus") by a certain amount (M is used to move backwards [aka "minus"])<number>: how much to move forwards byC: move by character. For simplicity, assumes that each character is one-cell wide.<name>P<number>L, <name>M<number>L:
segment#L<name>
segment# refers to the beginning of a segment of text in a row. The leftmost run of text is segment0, whereas the rightmost run of text is segment4.L<name> refers to the line number we're targeting, relative to the <name> variable. For example, Lorigin means that the y-position should be that of origin.segment0Lorigin and segment0LmidTop both refer to the beginning of the first segment of text on the top line (aka origin).TextUnit_Character, TextUnit_Word, and TextUnit_Line. See https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-uiautomationtextunits for more details.