aboutsummaryrefslogtreecommitdiffstats
path: root/tests/Test_Qt.DotNet.Generator/Test_AttributeExtensionsBehavior.cs
Commit message (Collapse)AuthorAgeFilesLines
* Validate QmlElement.Name and emit correct macros or errorKarsten Heimrich2025-11-101-0/+119
| | | | | | | | | | | | | | | | | | | | - GenerateClass: Precompute QML macros. If Name is explicitly provided but invalid, return a error (descriptive) instead of silently emitting QML_ELEMENT. Otherwise: * QML_ELEMENT when Name is omitted * QML_NAMED_ELEMENT(<Name>) when valid - TypeExtensionsForGenerationRules: Validate using ^[A-Z][A-Za-z0-9_]*$(First char uppercase, followed by letters/digits/underscores; rejects whitespace/special chars). - TestCodeGenerator: Include rule error messages in the thrown exception to aid debugging. - Tests: Verify named vs unnamed element macro emission, invalid-name failures, and singleton macro presence. Change-Id: I054728c625a7fff6b1dfcbf512811672ce18f38e Reviewed-by: Miguel Costa <miguel.costa@qt.io>
* Fix error with missing attributes propertiesKarsten Heimrich2025-11-101-0/+109
Setting an attrib without the `Name` property would cause code generation to fail (e.g., setting `[QmlElement(Singleton = true)]` on a type). Note: We cannot test the generic versions of {Try}Property<T> due to AssemblyLoadContext/type-identity mismatches (TypeOf<T>). - TypeExtensionsForGenerationRules.QmlElementName: Use TryProperty<string> to read optional properties. - Tests: Add coverage for misspelled/missing/valid QmlElement properties. Change-Id: I942c75a22de0a822a9544e44a393609fb6e903cd Reviewed-by: Miguel Costa <miguel.costa@qt.io>