Skip to content

Commit

Permalink
Merge branch 'master' into i3208-updateAddonsClient
Browse files Browse the repository at this point in the history
  • Loading branch information
josephsl committed Aug 1, 2019
2 parents 00dbe1c + 1af8775 commit f9aefda
Show file tree
Hide file tree
Showing 30 changed files with 675 additions and 186 deletions.
38 changes: 32 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ environment:
init:
- ps: |
# iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
$pythonVersion = (py --version)
echo $pythonVersion
if ($env:APPVEYOR_REPO_TAG_NAME -and $env:APPVEYOR_REPO_TAG_NAME.StartsWith("release-")) {
# Strip "release-" prefix.
$version = $env:APPVEYOR_REPO_TAG_NAME.Substring(8)
Expand Down Expand Up @@ -121,10 +123,11 @@ build_script:

before_test:
# install required packages
- py -m pip install -r tests/system/requirements.txt
- py -m pip install -r tests/system/requirements.txt -r tests/lint/lintInstall/requirements.txt
- mkdir testOutput
- mkdir testOutput\unit
- mkdir testOutput\system
- mkdir testOutput\lint
- ps: |
$errorCode=0
$nvdaLauncherFile=".\output\nvda"
Expand Down Expand Up @@ -157,6 +160,28 @@ test_script:
$wc = New-Object 'System.Net.WebClient'
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", $unitTestsXml)
if($errorCode -ne 0) { $host.SetShouldExit($errorCode) }
- ps: |
if($env:APPVEYOR_PULL_REQUEST_NUMBER) {
$lintOutput = (Resolve-Path .\testOutput\lint\)
$lintSource = (Resolve-Path .\tests\lint\)
git fetch -q origin $env:APPVEYOR_REPO_BRANCH
$prDiff = "$lintOutput\prDiff.patch"
git diff -U0 FETCH_HEAD...HEAD > $prDiff
$flake8Config = "$lintSource\flake8.ini"
$flake8Output = "$lintOutput\PR-Flake8.txt"
type "$prDiff" | py -m flake8 --diff --output-file="$flake8Output" --tee --config="$flake8Config"
if($LastExitCode -ne 0) {
$errorCode=$LastExitCode
Add-AppveyorMessage "PR introduces Flake8 errors"
}
Push-AppveyorArtifact $flake8Output
$junitXML = "$lintOutput\PR-Flake8.xml"
py "$lintSource\createJunitReport.py" "$flake8Output" "$junitXML"
Push-AppveyorArtifact $junitXML
$wc = New-Object 'System.Net.WebClient'
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", $junitXML)
if($errorCode -ne 0) { $host.SetShouldExit($errorCode) }
}
- ps: |
$testOutput = (Resolve-Path .\testOutput\)
$systemTestOutput = (Resolve-Path "$testOutput\system")
Expand All @@ -169,9 +194,10 @@ test_script:
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path "$systemTestOutput\systemTests.xml"))
if($errorCode -ne 0) { $host.SetShouldExit($errorCode) }
artifacts:
- path: output\*
- path: output\*\*
on_finish:
- ps: |
Get-ChildItem output\* | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
Get-ChildItem output\*\* | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
deploy_script:
- ps: |
Expand All @@ -180,9 +206,9 @@ deploy_script:
# Notify our server.
$exe = Get-ChildItem -Name output\*.exe
$hash = (Get-FileHash "output\$exe" -Algorithm SHA1).Hash.ToLower()
$apiVersion = (python -c "import sys; sys.path.append('source'); from addonAPIVersion import CURRENT; print('{}.{}.{}'.format(*CURRENT))")
$apiVersion = (py -c "import sys; sys.path.append('source'); from addonAPIVersion import CURRENT; print('{}.{}.{}'.format(*CURRENT))")
echo apiversion: $apiVersion
$apiCompatTo = (python -c "import sys; sys.path.append('source'); from addonAPIVersion import BACK_COMPAT_TO; print('{}.{}.{}'.format(*BACK_COMPAT_TO))")
$apiCompatTo = (py -c "import sys; sys.path.append('source'); from addonAPIVersion import BACK_COMPAT_TO; print('{}.{}.{}'.format(*BACK_COMPAT_TO))")
echo apiBackCompatTo: $apiCompatTo
$data = @{
jobId=$env:APPVEYOR_JOB_ID;
Expand Down
32 changes: 29 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,13 @@ Additionally, the following build time dependencies are included in Git submodul
* [Boost Optional (stand-alone header)](https://github.com/akrzemi1/Optional), from commit [3922965](https://github.com/akrzemi1/Optional/commit/3922965396fc455c6b1770374b9b4111799588a9)

### Other Dependencies
These dependencies are not included in Git submodules, but aren't needed by most people.
To lint using Flake 8 locally using our SCons integration, some dependencies are installed (automatically) via pip.
Although this [must be run manually](#linting-your-changes), developers may wish to first configure a Python Virtual Environment to ensure their general install is not affected.
* Flake8
* Flake8-tabs


The following dependencies aren't needed by most people, and are not included in Git submodules:

* To generate developer documentation for nvdaHelper: [Doxygen Windows installer](http://www.doxygen.nl/download.html), version 1.8.15:

Expand Down Expand Up @@ -155,6 +161,8 @@ scons dist

The build will be created in the dist directory.

### Building the installer

To create a launcher archive (one executable allowing for installation or portable dist generation), type:

```
Expand All @@ -163,6 +171,8 @@ scons launcher

The archive will be placed in the output directory.

### Building the developer documentation

To generate the NVDA developer guide, type:

```
Expand All @@ -180,6 +190,7 @@ scons devDocs_nvdaHelper

The documentation will be placed in the `devDocs\nvdaHelper` folder in the output directory.

### Generate debug symbols archive
To generate an archive of debug symbols for the various dll/exe binaries, type:

```
Expand All @@ -188,12 +199,14 @@ scons symbolsArchive

The archive will be placed in the output directory.

### Generate translation template
To generate a gettext translation template (for translators), type:

```
scons pot
```

### Customising the build
Optionally, the build can be customised by providing variables on the command line:

* version: The version of this build.
Expand All @@ -216,15 +229,15 @@ scons launcher version=test1
## Running Automated Tests
If you make a change to the NVDA code, you should run NVDA's automated tests.
These tests help to ensure that code changes do not unintentionally break functionality that was previously working.
Currently, NVDA has two kinds of automated testing: unit tests and translatable string checks.

To run the tests, first change directory to the root of the NVDA source distribution as above.
To run the tests (unit tests, translatable string checks), first change directory to the root of the NVDA source distribution as above.
Then, run:

```
scons tests
```

### Unit tests
To run only specific unit tests, specify them using the `unitTests` variable on the command line.
The tests should be provided as a comma separated list.
Each test should be specified as a Python module, class or method relative to the `tests\unit` directory.
Expand All @@ -234,12 +247,25 @@ For example, to run only methods in the `TestMove` and `TestSelection` classes i
scons tests unitTests=test_cursorManager.TestMove,test_cursorManager.TestSelection
```

### Translatable string checks
To run only the translatable string checks (which check that all translatable strings have translator comments), run:

```
scons checkPot
```

### Linting your changes
In order to ensure your changes comply with NVDA's coding style you can run the Flake8 linter locally.
Running via SCons will use Flake8 to inspect only the differences between your working directory and the specified `base` branch.
If you create a Pull Request, the `base` branch you use here should be the same as the target you would use for a Pull Request. In most cases it will be `origin/master`.
```
scons lint base=origin/master
```

To be warned about linting errors faster, you may wish to integrate Flake8 other development tools you are using.
For more details, see `tests/lint/readme.md`

### System Tests
You may also use scons to run the system tests, though this will still rely on having set up the dependencies (see `tests/system/readme.md`).

```
Expand Down
11 changes: 11 additions & 0 deletions sconstruct
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ vars.Add(ListVariable("nvdaHelperDebugFlags", "a list of debugging features you
vars.Add(EnumVariable('nvdaHelperLogLevel','The level of logging you wish to see, lower is more verbose','15',allowed_values=[str(x) for x in range(60)]))
if "tests" in COMMAND_LINE_TARGETS:
vars.Add("unitTests", "A list of unit tests to run", "")
if "lint" in COMMAND_LINE_TARGETS:
vars.Add( # pass through variable that lint is requested
"doLint",
"internal use",
True
)
vars.Add(
"base",
"Lint is done only on a diff, specify the ref to use as base for the diff.",
None
)
if "systemTests" in COMMAND_LINE_TARGETS:
vars.Add("filter", "A filter for the name of the system test(s) to run. Wildcards accepted.", "")

Expand Down
9 changes: 7 additions & 2 deletions source/NVDAObjects/IAccessible/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,12 @@ def findOverlayClasses(self,clsList):
elif windowClassName.startswith("Chrome_"):
from . import chromium
chromium.findExtraOverlayClasses(self, clsList)
if (
windowClassName == "ConsoleWindowClass"
and role == oleacc.ROLE_SYSTEM_CLIENT
):
from . import winConsole
winConsole.findExtraOverlayClasses(self,clsList)


#Support for Windowless richEdit
Expand Down Expand Up @@ -863,7 +869,7 @@ def _get_states(self):
log.debugWarning("could not get IAccessible states",exc_info=True)
else:
states.update(IAccessibleHandler.IAccessibleStatesToNVDAStates[x] for x in (y for y in (1<<z for z in range(32)) if y&IAccessibleStates) if x in IAccessibleHandler.IAccessibleStatesToNVDAStates)
if not hasattr(self.IAccessibleObject,'states'):
if not isinstance(self.IAccessibleObject,IAccessibleHandler.IAccessible2):
# Not an IA2 object.
return states
IAccessible2States=self.IA2States
Expand Down Expand Up @@ -2023,5 +2029,4 @@ def event_alert(self):
("NUIDialog",oleacc.ROLE_SYSTEM_CLIENT):"NUIDialogClient",
("_WwB",oleacc.ROLE_SYSTEM_CLIENT):"winword.ProtectedDocumentPane",
("MsoCommandBar",oleacc.ROLE_SYSTEM_LISTITEM):"msOffice.CommandBarListItem",
("ConsoleWindowClass",oleacc.ROLE_SYSTEM_CLIENT):"winConsole.WinConsole",
}
16 changes: 13 additions & 3 deletions source/NVDAObjects/IAccessible/winConsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,19 @@
#See the file COPYING for more details.
#Copyright (C) 2007-2019 NV Access Limited, Bill Dengler

import config

from winVersion import isWin10

from . import IAccessible
from ..window.winConsole import WinConsole
from ..window import winConsole

class WinConsole(WinConsole, IAccessible):
class WinConsole(winConsole.WinConsole, IAccessible):
"The legacy console implementation for situations where UIA isn't supported."
pass
pass

def findExtraOverlayClasses(obj, clsList):
if isWin10(1607) and config.conf['terminals']['keyboardSupportInLegacy']:
from NVDAObjects.behaviors import KeyboardHandlerBasedTypedCharSupport
clsList.append(KeyboardHandlerBasedTypedCharSupport)
clsList.append(WinConsole)
12 changes: 11 additions & 1 deletion source/NVDAObjects/UIA/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from UIAUtils import *
from NVDAObjects.window import Window
from NVDAObjects import NVDAObjectTextInfo, InvalidNVDAObject
from NVDAObjects.behaviors import ProgressBar, EditableTextWithoutAutoSelectDetection, Dialog, Notification, EditableTextWithSuggestions
from NVDAObjects.behaviors import ProgressBar, EditableTextWithoutAutoSelectDetection, Dialog, Notification, EditableTextWithSuggestions, ToolTip
import braille
import locationHelper
import ui
Expand Down Expand Up @@ -793,6 +793,10 @@ def findOverlayClasses(self,clsList):
clsList.append(Toast_win8)
elif self.windowClassName=="Windows.UI.Core.CoreWindow" and UIAControlType==UIAHandler.UIA_WindowControlTypeId and "ToastView" in self.UIAElement.cachedAutomationId: # Windows 10
clsList.append(Toast_win10)
# #8118: treat UIA tool tips (including those found in UWP apps) as proper tool tips, especially those found in Microsoft Edge and other apps.
# Windows 8.x toast, although a form of tool tip, is covered separately.
elif UIAControlType==UIAHandler.UIA_ToolTipControlTypeId:
clsList.append(ToolTip)
elif self.UIAElement.cachedFrameworkID in ("InternetExplorer","MicrosoftEdge"):
from . import edge
if UIAClassName in ("Internet Explorer_Server","WebView") and self.role==controlTypes.ROLE_PANE:
Expand Down Expand Up @@ -1647,6 +1651,12 @@ def event_UIA_window_windowOpen(self):
self.__class__._lastToastRuntimeID = toastRuntimeID
Notification.event_alert(self)


class ToolTip(ToolTip, UIA):

event_UIA_toolTipOpened=ToolTip.event_show


#WpfTextView fires name state changes once a second, plus when IUIAutomationTextRange::GetAttributeValue is called.
#This causes major lags when using this control with Braille in NVDA. (#2759)
#For now just ignore the events.
Expand Down
Loading

0 comments on commit f9aefda

Please sign in to comment.