* test: add failing tests for culture-sensitive class and IterationCount checks
Culture-sensitive comparisons ignore a soft hyphen (U+00AD), so a class
that starts with one followed by ':' is treated as a pseudoclass, and
"Infinite" followed by one still parses as Infinite.
* fix: use ordinal comparisons for pseudoclass checks and IterationCount.Parse
These checks test syntax, so a culture-sensitive comparison gives wrong
answers for ignorable characters and opens an ICU collator on the UI
thread at startup.
* refactor: spell out the ordinal comparison in IterationCount.Parse
The char overload was already ordinal, but no test covers this check,
so say so explicitly, as the EndsWith check above it does.
* Run unit tests that create a UI dispatcher in a scope
Seventy-two Avalonia.Base.UnitTests classes create Dispatcher.UIThread
without ScopedTestBase or UnitTestApplication and never release it, and
TestWithServicesBase, the base of two more, creates one while disposing. The
dispatcher stays bound to the thread that created it; tests run one at a time
but not on one thread, so when the next test lands on another thread
bindings post their values instead of publishing them and whole classes such
as BindingExpressionTests and SetterTests fail.
- Derive those classes from ScopedTestBase, which resets the dispatcher and
the locator around every test.
- Move GlyphRunTests and DiagnosticTextRendererTests from TestWithServicesBase
to ScopedTestBase and delete TestWithServicesBase, which only scoped the
locator.
* Add failing tests for VerifyEmptyDispatcherAfterTest leak detection
An unscoped test that leaves Dispatcher.UIThread behind passes today and
breaks whichever test next runs on another thread. The attribute's own check
also creates a UI dispatcher after tests that never touched one.
* Fail unscoped tests that leave a UI dispatcher behind
VerifyEmptyDispatcherAfterTest only checked for leftover jobs, so a test that
created Dispatcher.UIThread outside ScopedTestBase or UnitTestApplication
passed and broke whichever test next ran on another thread. Its own check
also created a UI dispatcher after tests that never touched one.
- Look the dispatcher up with TryGetUIThread instead of creating one.
- Fail when an unscoped test leaves a UI dispatcher, listing any leftover
jobs as before, and release it so the failure stays with that test.
* Enable nullability in UnitTests
* Enable nullability in Base.UnitTests
* Enable nullability in Markup.UnitTests
* Enable nullability in Markup.Xaml.UnitTests
* Merge core libraries.
Everything below `Avalonia.Controls` into `Avalonia.Base`.
* Move new files to correct place.
* Removed unused dirs/projects,
* Removed outdated references from theme assemblies.
* Merge unit tests to match new assembly layout.
* Fixup test namespaces.
* Make directory match namespace.
* Move files to match namespace.
* Move files to match namespace.
* Fix up incorrect namespace.
`Avalonia.Visuals.Media.Imaging` -> `Avalonia.Media.Imaging`.
* Fix resource URL.
* Removed outdated dependencies.
* Added missing project reference.
* Update test namespaces.
* Fix merge error.
* Fix merge errors.
* Fix bad merge in WindowsInteropTest.csproj.
* Fix up merge errors in csprojs.
* Remove merged tests from nuke.
* Fix up namespace.
* Fix compile error.
* Fix failing tests.
Now that more unit tests are present in Avalonia.Base.UnitTests, general `AvaloniaObject` properties are getting registered. Ignore those.
Co-authored-by: Jumar Macato <16554748+jmacato@users.noreply.github.com>
- Don't use Rx in the styling system. Instead introduces `IStyleActivator` which is like an `IObservable<bool>`-lite in order to cut down on allocations.
- #nullable enable on touched files
A lot of time was being spent calling `Attach` on styles that will never match a control. On the first pass, cache the styles that can match a particular control type and use this cache to bypass styles that will never match on subsequent passes.