diff options
author | Marco Bubke <marco.bubke@qt.io> | 2024-04-03 16:38:23 +0200 |
---|---|---|
committer | Marco Bubke <marco.bubke@qt.io> | 2024-04-22 15:34:53 +0000 |
commit | e262ec1ebbb51402fdd8583e51f131ee5f04e3a6 (patch) | |
tree | 1c272053c53e84cf0e29aef9886f5a3511e2b4e5 /tests | |
parent | e9ee1c6b567eb9a68be887254733ec5c1080c169 (diff) |
QmlDesigner: Integrate item library entries from project storage
Task-number: QDS-12102
Change-Id: Id6fbfcfb44d3b8c290f5e5d74addf33ef4d9a5e5
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Diffstat (limited to 'tests')
16 files changed, 3731 insertions, 122 deletions
diff --git a/tests/unit/tests/matchers/projectstorage-matcher.h b/tests/unit/tests/matchers/projectstorage-matcher.h index 5ce6512c14..02861d7eea 100644 --- a/tests/unit/tests/matchers/projectstorage-matcher.h +++ b/tests/unit/tests/matchers/projectstorage-matcher.h @@ -53,3 +53,24 @@ MATCHER_P3(IsItemLibraryProperty, return property.name == name && property.type == type && property.value == value; } + +template<typename IconPathMatcher, typename TypeTraitsMatcher, typename HintsJsonMatcher, typename ItemLibraryJsonMatcher> +auto IsTypeAnnotation(QmlDesigner::SourceId sourceId, + QmlDesigner::SourceId directorySourceId, + Utils::SmallStringView typeName, + QmlDesigner::ModuleId moduleId, + IconPathMatcher iconPath, + TypeTraitsMatcher traits, + HintsJsonMatcher hintsJsonMatcher, + ItemLibraryJsonMatcher itemLibraryJsonMatcher) +{ + using QmlDesigner::Storage::Synchronization::TypeAnnotation; + return AllOf(Field("sourceId", &TypeAnnotation::sourceId, sourceId), + Field("sourceId", &TypeAnnotation::directorySourceId, directorySourceId), + Field("typeName", &TypeAnnotation::typeName, typeName), + Field("moduleId", &TypeAnnotation::moduleId, moduleId), + Field("iconPath", &TypeAnnotation::iconPath, iconPath), + Field("traits", &TypeAnnotation::traits, traits), + Field("hintsJson", &TypeAnnotation::hintsJson, hintsJsonMatcher), + Field("itemLibraryJson", &TypeAnnotation::itemLibraryJson, itemLibraryJsonMatcher)); +} diff --git a/tests/unit/tests/matchers/unittest-matchers.h b/tests/unit/tests/matchers/unittest-matchers.h index 7c52d973b8..faa99a48a2 100644 --- a/tests/unit/tests/matchers/unittest-matchers.h +++ b/tests/unit/tests/matchers/unittest-matchers.h @@ -95,6 +95,64 @@ private: const QString m_suffix; }; +template<typename StringType> +class StartsWithMatcher +{ +public: + explicit StartsWithMatcher(const StringType &prefix) + : m_prefix(prefix) + {} + + template<typename CharType> + bool MatchAndExplain(CharType *s, testing::MatchResultListener *listener) const + { + return s != NULL && MatchAndExplain(StringType(s), listener); + } + + template<typename MatcheeStringType> + bool MatchAndExplain(const MatcheeStringType &s, testing::MatchResultListener * /* listener */) const + { + return s.startsWith(m_prefix); + } + + void DescribeTo(::std::ostream *os) const { *os << "ends with " << m_prefix; } + + void DescribeNegationTo(::std::ostream *os) const { *os << "doesn't end with " << m_prefix; } + + StartsWithMatcher(const StartsWithMatcher &) = default; + StartsWithMatcher &operator=(const StartsWithMatcher &) = delete; + +private: + const StringType m_prefix; +}; + +class QStringStartsWithMatcher +{ +public: + explicit QStringStartsWithMatcher(const QString &prefix) + : m_prefix(prefix) + {} + + template<typename MatcheeStringType> + bool MatchAndExplain(const MatcheeStringType &s, testing::MatchResultListener * /* listener */) const + { + return s.startsWith(m_prefix); + } + + void DescribeTo(::std::ostream *os) const + { + *os << "ends with " << testing::PrintToString(m_prefix); + } + + void DescribeNegationTo(::std::ostream *os) const + { + *os << "doesn't end with " << testing::PrintToString(m_prefix); + } + +private: + const QString m_prefix; +}; + class IsEmptyMatcher { public: @@ -157,6 +215,16 @@ inline auto EndsWith(const QStringView &suffix) return ::testing::PolymorphicMatcher(Internal::QStringEndsWithMatcher(suffix.toString())); } +inline auto StartsWith(const Utils::SmallStringView &prefix) +{ + return ::testing::PolymorphicMatcher(Internal::StartsWithMatcher(prefix)); +} + +inline auto StartsWith(const QStringView &prefix) +{ + return ::testing::PolymorphicMatcher(Internal::QStringStartsWithMatcher(prefix.toString())); +} + inline auto IsEmpty() { return ::testing::PolymorphicMatcher(Internal::IsEmptyMatcher()); diff --git a/tests/unit/tests/mocks/projectstoragemock.h b/tests/unit/tests/mocks/projectstoragemock.h index b534814c1d..8aa5979ddb 100644 --- a/tests/unit/tests/mocks/projectstoragemock.h +++ b/tests/unit/tests/mocks/projectstoragemock.h @@ -195,6 +195,11 @@ public: type, (QmlDesigner::TypeId typeId), (const, override)); + MOCK_METHOD(QmlDesigner::SmallSourceIds<4>, + typeAnnotationSourceIds, + (QmlDesigner::SourceId directoryId), + (const, override)); + MOCK_METHOD(QmlDesigner::SmallSourceIds<64>, typeAnnotationDirectorySourceIds, (), (const, override)); MOCK_METHOD(Utils::PathString, typeIconPath, (QmlDesigner::TypeId typeId), (const, override)); MOCK_METHOD(QmlDesigner::Storage::Info::TypeHints, typeHints, diff --git a/tests/unit/tests/printers/gtest-creator-printing.cpp b/tests/unit/tests/printers/gtest-creator-printing.cpp index 40f9c8db6d..6bc78e9936 100644 --- a/tests/unit/tests/printers/gtest-creator-printing.cpp +++ b/tests/unit/tests/printers/gtest-creator-printing.cpp @@ -795,7 +795,10 @@ std::ostream &operator<<(std::ostream &out, const SynchronizationPackage &packag << ", projectDatas: " << package.projectDatas << ", propertyEditorQmlPaths: " << package.propertyEditorQmlPaths << ", updatedPropertyEditorQmlPathSourceIds: " - << package.updatedPropertyEditorQmlPathSourceIds << ")"; + << package.updatedPropertyEditorQmlPathSourceIds + << ", typeAnnotations: " << package.typeAnnotations + << ", updatedTypeAnnotationSourceIds: " << package.updatedTypeAnnotationSourceIds + << ")"; } std::ostream &operator<<(std::ostream &out, const ProjectData &data) diff --git a/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick/Controls/designer/qtquickcontrols2.metainfo b/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick/Controls/designer/qtquickcontrols2.metainfo new file mode 100644 index 0000000000..0cd3959cf8 --- /dev/null +++ b/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick/Controls/designer/qtquickcontrols2.metainfo @@ -0,0 +1,575 @@ +MetaInfo { + Type { + name: "QtQuick.Controls.BusyIndicator" + icon: "images/busyindicator-icon16.png" + + ItemLibraryEntry { + name: "Busy Indicator" + category: "Qt Quick - Controls 2" + libraryIcon: "images/busyindicator-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("Indicates activity while, for example, content is being loaded.") + } + } + + Type { + name: "QtQuick.Controls.Button" + icon: "images/button-icon16.png" + + ItemLibraryEntry { + name: "Button" + category: "Qt Quick - Controls 2" + libraryIcon: "images/button-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("A button with text.") + + Property { name: "text"; type: "binding"; value: "qsTr(\"Button\")" } + } + } + + Type { + name: "QtQuick.Controls.CheckBox" + icon: "images/checkbox-icon16.png" + + ItemLibraryEntry { + name: "Check Box" + category: "Qt Quick - Controls 2" + libraryIcon: "images/checkbox-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("A checkbox with a text label.") + + Property { name: "text"; type: "binding"; value: "qsTr(\"Check Box\")" } + } + } + + Type { + name: "QtQuick.Controls.CheckDelegate" + icon: "images/checkbox-icon16.png" + + ItemLibraryEntry { + name: "Check Delegate" + category: "Qt Quick - Controls 2" + libraryIcon: "images/checkbox-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("Presents items from a model as checkboxes.") + + Property { name: "text"; type: "binding"; value: "qsTr(\"Check Delegate\")" } + } + } + + Type { + name: "QtQuick.Controls.ComboBox" + icon: "images/combobox-icon16.png" + + ItemLibraryEntry { + name: "Combo Box" + category: "Qt Quick - Controls 2" + libraryIcon: "images/combobox-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("An editable drop-down list.") + } + } + + Type { + name: "QtQuick.Controls.Control" + icon: "images/control-icon16.png" + + ItemLibraryEntry { + name: "Control" + category: "Qt Quick - Controls 2" + libraryIcon: "images/control-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("An abstract base type for UI controls.") + } + } + + Type { + name: "QtQuick.Controls.DelayButton" + icon: "images/button-icon16.png" + + ItemLibraryEntry { + name: "Delay Button" + category: "Qt Quick - Controls 2" + libraryIcon: "images/delaybutton-icon.png" + version: "2.2" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("A button with a delay preventing accidental presses.") + + Property { name: "text"; type: "binding"; value: "qsTr(\"Delay Button\")" } + } + } + + Type { + name: "QtQuick.Controls.Dial" + icon: "images/dial-icon16.png" + + ItemLibraryEntry { + name: "Dial" + category: "Qt Quick - Controls 2" + libraryIcon: "images/dial-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + + toolTip: qsTr("A circular dial that is rotated to set a value.") + } + } + + Type { + name: "QtQuick.Controls.Frame" + icon: "images/frame-icon16.png" + + ItemLibraryEntry { + name: "Frame" + category: "Qt Quick - Controls 2" + libraryIcon: "images/frame-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("An untitled container for a group of controls.") + + Property { name: "width"; type: "int"; value: 200 } + Property { name: "height"; type: "int"; value: 200 } + } + } + + Type { + name: "QtQuick.Controls.GroupBox" + icon: "images/groupbox-icon16.png" + + ItemLibraryEntry { + name: "Group Box" + category: "Qt Quick - Controls 2" + libraryIcon: "images/groupbox-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("A titled container for a group of controls.") + + Property { name: "width"; type: "int"; value: 200 } + Property { name: "height"; type: "int"; value: 200 } + Property { name: "title"; type: "binding"; value: "qsTr(\"Group Box\")" } + } + } + + Type { + name: "QtQuick.Controls.ItemDelegate" + icon: "images/itemdelegate-icon16.png" + + ItemLibraryEntry { + name: "Item Delegate" + category: "Qt Quick - Controls 2" + libraryIcon: "images/itemdelegate-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("Presents a standard view item. It can be used as a delegate in various views and controls, such as ListView and ComboBox.") + + Property { name: "text"; type: "binding"; value: "qsTr(\"Item Delegate\")" } + } + } + + Type { + name: "QtQuick.Controls.Label" + icon: "images/label-icon16.png" + + ItemLibraryEntry { + name: "Label" + category: "Qt Quick - Controls 2" + libraryIcon: "images/label-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("A text label.") + + Property { name: "text"; type: "binding"; value: "qsTr(\"Label\")" } + } + } + + Type { + name: "QtQuick.Controls.Page" + icon: "images/page-icon16.png" + + ItemLibraryEntry { + name: "Page" + category: "Qt Quick - Controls 2" + libraryIcon: "images/page-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("A page with header and footer.") + + Property { name: "width"; type: "int"; value: 200 } + Property { name: "height"; type: "int"; value: 200 } + } + } + + Type { + name: "QtQuick.Controls.PageIndicator" + icon: "images/pageindicator-icon16.png" + + ItemLibraryEntry { + name: "Page Indicator" + category: "Qt Quick - Controls 2" + libraryIcon: "images/pageindicator-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("Indicates the currently active page.") + + Property { name: "count"; type: "int"; value: 3 } + } + } + + Type { + name: "QtQuick.Controls.Pane" + icon: "images/pane-icon16.png" + + ItemLibraryEntry { + name: "Pane" + category: "Qt Quick - Controls 2" + libraryIcon: "images/pane-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("Provides a background matching the application style and theme.") + + Property { name: "width"; type: "int"; value: 200 } + Property { name: "height"; type: "int"; value: 200 } + } + } + + Type { + name: "QtQuick.Controls.ProgressBar" + icon: "images/progressbar-icon16.png" + + ItemLibraryEntry { + name: "Progress Bar" + category: "Qt Quick - Controls 2" + libraryIcon: "images/progressbar-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("A bar indicating the progress of an operation.") + + Property { name: "value"; type: "real"; value: 0.5 } + } + } + + Type { + name: "QtQuick.Controls.RadioButton" + icon: "images/radiobutton-icon16.png" + + ItemLibraryEntry { + name: "Radio Button" + category: "Qt Quick - Controls 2" + libraryIcon: "images/radiobutton-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("An option button that you can toggle on or off.") + + Property { name: "text"; type: "binding"; value: "qsTr(\"Radio Button\")" } + } + } + + Type { + name: "QtQuick.Controls.RadioDelegate" + icon: "images/radiobutton-icon16.png" + + ItemLibraryEntry { + name: "Radio Delegate" + category: "Qt Quick - Controls 2" + libraryIcon: "images/radiobutton-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("Presents items from a model as radio buttons.") + + Property { name: "text"; type: "binding"; value: "qsTr(\"Radio Delegate\")" } + } + } + + Type { + name: "QtQuick.Controls.RangeSlider" + icon: "images/rangeslider-icon16.png" + + ItemLibraryEntry { + name: "Range Slider" + category: "Qt Quick - Controls 2" + libraryIcon: "images/rangeslider-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("A bar with adjustable start and end points.") + + Property { name: "first.value"; type: "real"; value: 0.25 } + Property { name: "second.value"; type: "real"; value: 0.75 } + } + } + + Type { + name: "QtQuick.Controls.RoundButton" + icon: "images/roundbutton-icon16.png" + + ItemLibraryEntry { + name: "Round Button" + category: "Qt Quick - Controls 2" + libraryIcon: "images/roundbutton-icon.png" + version: "2.1" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("A round button with text.") + + Property { name: "text"; type: "string"; value: "+" } + } + } + + Type { + name: "QtQuick.Controls.Slider" + icon: "images/slider-icon16.png" + + ItemLibraryEntry { + name: "Slider" + category: "Qt Quick - Controls 2" + libraryIcon: "images/slider-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("An adjustable slider.") + + Property { name: "value"; type: "real"; value: 0.5 } + } + } + + Type { + name: "QtQuick.Controls.SpinBox" + icon: "images/spinbox-icon16.png" + + ItemLibraryEntry { + name: "Spin Box" + category: "Qt Quick - Controls 2" + libraryIcon: "images/spinbox-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("A box with an adjustable number.") + } + } + + Type { + name: "QtQuick.Controls.ScrollView" + icon: "images/scrollview-icon16.png" + + ItemLibraryEntry { + name: "Scroll View" + category: "Qt Quick - Controls 2" + libraryIcon: "images/scrollview-icon.png" + version: "2.2" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("A scrollable area.") + + Property { name: "width"; type: "int"; value: 200 } + Property { name: "height"; type: "int"; value: 200 } + } + } + + Type { + name: "QtQuick.Controls.StackView" + icon: "images/stackview-icon16.png" + + ItemLibraryEntry { + name: "Stack View" + category: "Qt Quick - Controls 2" + libraryIcon: "images/stackview-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("Provides a stack-based navigation for a set of pages.") + + Property { name: "width"; type: "int"; value: 200 } + Property { name: "height"; type: "int"; value: 200 } + } + } + + Type { + name: "QtQuick.Controls.SwipeDelegate" + icon: "images/itemdelegate-icon16.png" + + ItemLibraryEntry { + name: "Swipe Delegate" + category: "Qt Quick - Controls 2" + libraryIcon: "images/itemdelegate-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("Presents items from a model as items that you can swipe to expose more options.") + + Property { name: "text"; type: "binding"; value: "qsTr(\"Swipe Delegate\")" } + } + } + + Type { + name: "QtQuick.Controls.SwipeView" + icon: "images/swipeview-icon16.png" + + ItemLibraryEntry { + name: "Swipe View" + category: "Qt Quick - Controls 2" + libraryIcon: "images/swipeview-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("Provides a view where you can navigate pages by swiping.") + + Property { name: "width"; type: "int"; value: 200 } + Property { name: "height"; type: "int"; value: 200 } + } + } + + Type { + name: "QtQuick.Controls.Switch" + icon: "images/switch-icon16.png" + + ItemLibraryEntry { + name: "Switch" + category: "Qt Quick - Controls 2" + libraryIcon: "images/switch-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("A button that you can toggle on and off.") + + Property { name: "text"; type: "binding"; value: "qsTr(\"Switch\")" } + } + } + + Type { + name: "QtQuick.Controls.SwitchDelegate" + icon: "images/switch-icon16.png" + + ItemLibraryEntry { + name: "Switch Delegate" + category: "Qt Quick - Controls 2" + libraryIcon: "images/switch-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("Presents items from a model as toggle switches.") + + Property { name: "text"; type: "binding"; value: "qsTr(\"Switch Delegate\")" } + } + } + + Type { + name: "QtQuick.Controls.TabBar" + icon: "images/toolbar-icon16.png" + + ItemLibraryEntry { + name: "Tab Bar" + category: "Qt Quick - Controls 2" + libraryIcon: "images/toolbar-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("A tab-based navigation model.") + + Property { name: "width"; type: "int"; value: 240 } + } + } + + Type { + name: "QtQuick.Controls.TabButton" + icon: "images/toolbutton-icon16.png" + + ItemLibraryEntry { + name: "Tab Button" + category: "Qt Quick - Controls 2" + libraryIcon: "images/toolbutton-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("A button suitable for a tab bar.") + + Property { name: "text"; type: "binding"; value: "qsTr(\"Tab Button\")" } + } + } + + Type { + name: "QtQuick.Controls.TextArea" + icon: "images/textarea-icon16.png" + + ItemLibraryEntry { + name: "Text Area" + category: "Qt Quick - Controls 2" + libraryIcon: "images/textarea-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("A multi-line text box.") + + Property { name: "placeholderText"; type: "binding"; value: "qsTr(\"Text Area\")" } + } + } + + Type { + name: "QtQuick.Controls.TextField" + icon: "images/textfield-icon16.png" + + ItemLibraryEntry { + name: "Text Field" + category: "Qt Quick - Controls 2" + libraryIcon: "images/textfield-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("A single-line text box.") + + Property { name: "placeholderText"; type: "binding"; value: "qsTr(\"Text Field\")" } + } + } + + Type { + name: "QtQuick.Controls.ToolBar" + icon: "images/toolbar-icon16.png" + + ItemLibraryEntry { + name: "Tool Bar" + category: "Qt Quick - Controls 2" + libraryIcon: "images/toolbar-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("A row that can hold actions and buttons.") + + Property { name: "width"; type: "int"; value: 360 } + } + } + + Type { + name: "QtQuick.Controls.ToolButton" + icon: "images/toolbutton-icon16.png" + + ItemLibraryEntry { + name: "Tool Button" + category: "Qt Quick - Controls 2" + libraryIcon: "images/toolbutton-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("A button suitable for a tool bar.") + + Property { name: "text"; type: "binding"; value: "qsTr(\"Tool Button\")" } + } + } + + Type { + name: "QtQuick.Controls.ToolSeparator" + icon: "images/toolseparator-icon16.png" + + ItemLibraryEntry { + name: "Tool Separator" + category: "Qt Quick - Controls 2" + libraryIcon: "images/toolseparator-icon.png" + version: "2.1" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("A line to separate sections in a tool bar.") + } + } + + Type { + name: "QtQuick.Controls.Tumbler" + icon: "images/tumbler-icon16.png" + + ItemLibraryEntry { + name: "Tumbler" + category: "Qt Quick - Controls 2" + libraryIcon: "images/tumbler-icon.png" + version: "2.0" + requiredImport: "QtQuick.Controls" + toolTip: qsTr("A spinnable wheel of selectable items.") + + Property { name: "model"; type: "int"; value: "10" } + } + } +} diff --git a/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick3D/AssetUtils/designer/assetutils.metainfo b/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick3D/AssetUtils/designer/assetutils.metainfo new file mode 100644 index 0000000000..47abeea7a3 --- /dev/null +++ b/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick3D/AssetUtils/designer/assetutils.metainfo @@ -0,0 +1,21 @@ +MetaInfo { + Type { + name: "QtQuick3D.AssetUtils.RuntimeLoader" + icon: "images/runtimeloader16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Runtime Loader" + category: "AssetUtils" + libraryIcon: "images/runtimeloader.png" + version: "6.2" + requiredImport: "QtQuick3D.AssetUtils" + } + } +} diff --git a/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick3D/Effects/designer/effectlib.metainfo b/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick3D/Effects/designer/effectlib.metainfo new file mode 100644 index 0000000000..7ad3357894 --- /dev/null +++ b/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick3D/Effects/designer/effectlib.metainfo @@ -0,0 +1,401 @@ +MetaInfo { + Type { + name: "QtQuick3D.Effects.AdditiveColorGradient" + icon: "images/effect16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Additive Color Gradient" + category: "Qt Quick 3D Effects" + libraryIcon: "images/effect.png" + version: "1.0" + requiredImport: "QtQuick3D.Effects" + } + } + Type { + name: "QtQuick3D.Effects.Blur" + icon: "images/effect16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Blur" + category: "Qt Quick 3D Effects" + libraryIcon: "images/effect.png" + version: "1.0" + requiredImport: "QtQuick3D.Effects" + } + } + Type { + name: "QtQuick3D.Effects.BrushStrokes" + icon: "images/effect16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Brush Strokes" + category: "Qt Quick 3D Effects" + libraryIcon: "images/effect.png" + version: "1.0" + requiredImport: "QtQuick3D.Effects" + } + } + Type { + name: "QtQuick3D.Effects.ChromaticAberration" + icon: "images/effect16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Chromatic Aberration" + category: "Qt Quick 3D Effects" + libraryIcon: "images/effect.png" + version: "1.0" + requiredImport: "QtQuick3D.Effects" + } + } + Type { + name: "QtQuick3D.Effects.ColorMaster" + icon: "images/effect16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Color Master" + category: "Qt Quick 3D Effects" + libraryIcon: "images/effect.png" + version: "1.0" + requiredImport: "QtQuick3D.Effects" + } + } + Type { + name: "QtQuick3D.Effects.DepthOfFieldHQBlur" + icon: "images/effect16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Depth of Field HQ Blur" + category: "Qt Quick 3D Effects" + libraryIcon: "images/effect.png" + version: "1.0" + requiredImport: "QtQuick3D.Effects" + } + } + Type { + name: "QtQuick3D.Effects.Desaturate" + icon: "images/effect16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Desaturate" + category: "Qt Quick 3D Effects" + libraryIcon: "images/effect.png" + version: "1.0" + requiredImport: "QtQuick3D.Effects" + } + } + Type { + name: "QtQuick3D.Effects.DistortionRipple" + icon: "images/effect16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Distortion Ripple" + category: "Qt Quick 3D Effects" + libraryIcon: "images/effect.png" + version: "1.0" + requiredImport: "QtQuick3D.Effects" + } + } + Type { + name: "QtQuick3D.Effects.DistortionSphere" + icon: "images/effect16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Distortion Sphere" + category: "Qt Quick 3D Effects" + libraryIcon: "images/effect.png" + version: "1.0" + requiredImport: "QtQuick3D.Effects" + } + } + Type { + name: "QtQuick3D.Effects.DistortionSpiral" + icon: "images/effect16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Distortion Spiral" + category: "Qt Quick 3D Effects" + libraryIcon: "images/effect.png" + version: "1.0" + requiredImport: "QtQuick3D.Effects" + } + } + Type { + name: "QtQuick3D.Effects.EdgeDetect" + icon: "images/effect16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Edge Detect" + category: "Qt Quick 3D Effects" + libraryIcon: "images/effect.png" + version: "1.0" + requiredImport: "QtQuick3D.Effects" + } + } + Type { + name: "QtQuick3D.Effects.Emboss" + icon: "images/effect16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Emboss" + category: "Qt Quick 3D Effects" + libraryIcon: "images/effect.png" + version: "1.0" + requiredImport: "QtQuick3D.Effects" + } + } + Type { + name: "QtQuick3D.Effects.Flip" + icon: "images/effect16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Flip" + category: "Qt Quick 3D Effects" + libraryIcon: "images/effect.png" + version: "1.0" + requiredImport: "QtQuick3D.Effects" + } + } + Type { + name: "QtQuick3D.Effects.Fxaa" + icon: "images/effect16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Fxaa" + category: "Qt Quick 3D Effects" + libraryIcon: "images/effect.png" + version: "1.0" + requiredImport: "QtQuick3D.Effects" + } + } + Type { + name: "QtQuick3D.Effects.GaussianBlur" + icon: "images/effect16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Gaussian Blur" + category: "Qt Quick 3D Effects" + libraryIcon: "images/effect.png" + version: "1.0" + requiredImport: "QtQuick3D.Effects" + } + } + Type { + name: "QtQuick3D.Effects.HDRBloomTonemap" + icon: "images/effect16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "HDR Bloom Tonemap" + category: "Qt Quick 3D Effects" + libraryIcon: "images/effect.png" + version: "1.0" + requiredImport: "QtQuick3D.Effects" + } + } + Type { + name: "QtQuick3D.Effects.MotionBlur" + icon: "images/effect16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Motion Blur" + category: "Qt Quick 3D Effects" + libraryIcon: "images/effect.png" + version: "1.0" + requiredImport: "QtQuick3D.Effects" + } + } + Type { + name: "QtQuick3D.Effects.Scatter" + icon: "images/effect16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Scatter" + category: "Qt Quick 3D Effects" + libraryIcon: "images/effect.png" + version: "1.0" + requiredImport: "QtQuick3D.Effects" + } + } + Type { + name: "QtQuick3D.Effects.SCurveTonemap" + icon: "images/effect16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "SCurve Tonemap" + category: "Qt Quick 3D Effects" + libraryIcon: "images/effect.png" + version: "1.0" + requiredImport: "QtQuick3D.Effects" + } + } + Type { + name: "QtQuick3D.Effects.TiltShift" + icon: "images/effect16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Tilt Shift" + category: "Qt Quick 3D Effects" + libraryIcon: "images/effect.png" + version: "1.0" + requiredImport: "QtQuick3D.Effects" + } + } + Type { + name: "QtQuick3D.Effects.Vignette" + icon: "images/effect16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Vignette" + category: "Qt Quick 3D Effects" + libraryIcon: "images/effect.png" + version: "1.0" + requiredImport: "QtQuick3D.Effects" + } + } +} diff --git a/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick3D/Helpers/designer/helpers.metainfo b/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick3D/Helpers/designer/helpers.metainfo new file mode 100644 index 0000000000..83492e2c81 --- /dev/null +++ b/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick3D/Helpers/designer/helpers.metainfo @@ -0,0 +1,261 @@ +MetaInfo { + Type { + name: "QtQuick3D.Helpers.LookAtNode" + icon: "images/lookatnode16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Look-at Node" + category: "Helpers" + libraryIcon: "images/lookatnode.png" + version: "6.4" + requiredImport: "QtQuick3D.Helpers" + } + } + + Type { + name: "QtQuick3D.Helpers.AxisHelper" + icon: "images/axishelper16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Axis Helper" + category: "Helpers" + libraryIcon: "images/axishelper.png" + version: "6.0" + requiredImport: "QtQuick3D.Helpers" + } + } + + Type { + name: "QtQuick3D.Helpers.DebugView" + icon: "images/debugview16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: true + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Debug View" + category: "Helpers" + libraryIcon: "images/debugview.png" + version: "6.0" + requiredImport: "QtQuick3D.Helpers" + } + } + + Type { + name: "QtQuick3D.Helpers.GridGeometry" + icon: "images/gridgeometry16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Grid Geometry" + category: "Helpers" + libraryIcon: "images/gridgeometry.png" + version: "6.0" + requiredImport: "QtQuick3D.Helpers" + } + } + + Type { + name: "QtQuick3D.Helpers.HeightFieldGeometry" + icon: "images/heightfieldgeometry16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Height Field Geometry" + category: "Helpers" + libraryIcon: "images/heightfieldgeometry.png" + version: "6.4" + requiredImport: "QtQuick3D.Helpers" + } + } + + Type { + name: "QtQuick3D.Helpers.InstanceModel" + icon: "images/instancemodel16.png" + + Hints { + visibleInNavigator: false + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Instance Model" + category: "Helpers" + libraryIcon: "images/instancemodel.png" + version: "6.4" + requiredImport: "QtQuick3D.Helpers" + } + } + + Type { + name: "QtQuick3D.Helpers.InstanceRepeater" + icon: "images/instancerepeater16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Instance Repeater" + category: "Helpers" + libraryIcon: "images/instancerepeater.png" + version: "6.4" + requiredImport: "QtQuick3D.Helpers" + } + } + + Type { + name: "QtQuick3D.Helpers.WasdController" + icon: "images/wasdcontroller16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: true + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Wasd Controller" + category: "Helpers" + libraryIcon: "images/wasdcontroller.png" + version: "6.0" + requiredImport: "QtQuick3D.Helpers" + } + } + + Type { + name: "QtQuick3D.Helpers.InfiniteGrid" + icon: "images/infinitegrid16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Infinite Grid" + category: "Helpers" + libraryIcon: "images/infinitegrid.png" + version: "6.5" + requiredImport: "QtQuick3D.Helpers" + } + } + + Type { + name: "QtQuick3D.Helpers.OrbitCameraController" + icon: "images/orbitcameracontroller16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: true + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Orbit Camera Controller" + category: "Helpers" + libraryIcon: "images/orbitcameracontroller.png" + version: "6.4" + requiredImport: "QtQuick3D.Helpers" + } + } + + Type { + name: "QtQuick3D.Helpers.ProceduralSkyTextureData" + icon: "images/proceduralskytexturedata16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Procedural Sky Texture Data" + category: "Helpers" + libraryIcon: "images/proceduralskytexturedata.png" + version: "6.4" + requiredImport: "QtQuick3D.Helpers" + } + } + + Type { + name: "QtQuick3D.Helpers.ExtendedSceneEnvironment" + icon: "images/extendedsceneenvironment16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Extended Scene Environment" + category: "Helpers" + libraryIcon: "images/extendedsceneenvironment.png" + version: "6.5" + requiredImport: "QtQuick3D.Helpers" + } + } + + Type { + name: "QtQuick3D.Helpers.LodManager" + icon: "images/lodmanager16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Lod Manager" + category: "Helpers" + libraryIcon: "images/lodmanager.png" + version: "6.5" + requiredImport: "QtQuick3D.Helpers" + } + } +} diff --git a/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick3D/ParticleEffects/designer/particleeffects.metainfo b/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick3D/ParticleEffects/designer/particleeffects.metainfo new file mode 100644 index 0000000000..d9bc305b4a --- /dev/null +++ b/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick3D/ParticleEffects/designer/particleeffects.metainfo @@ -0,0 +1,246 @@ +MetaInfo { + Type { + name: "QtQuick3D.Particle3D.ParticleSystem3D" + icon: "images/dummy16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Clouds" + category: "Qt Quick 3D Particle Effects" + libraryIcon: "images/dummy.png" + version: "6.2" + requiredImport: "QtQuick3D.ParticleEffects" + QmlSource { source: "./source/particleeffect_clouds.qml" } + ExtraFile { source: "images/smoke_sprite2.png" } + } + } + + Type { + name: "QtQuick3D.Particle3D.ParticleSystem3D" + icon: "images/dummy16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Dust" + category: "Qt Quick 3D Particle Effects" + libraryIcon: "images/dummy.png" + version: "6.2" + requiredImport: "QtQuick3D.ParticleEffects" + QmlSource { source: "./source/particleeffect_dust.qml" } + ExtraFile { source: "images/sphere.png" } + } + } + + Type { + name: "QtQuick3D.Particle3D.ParticleSystem3D" + icon: "images/dummy16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Exhaust" + category: "Qt Quick 3D Particle Effects" + libraryIcon: "images/dummy.png" + version: "6.2" + requiredImport: "QtQuick3D.ParticleEffects" + QmlSource { source: "./source/particleeffect_exhaust.qml" } + ExtraFile { source: "images/smoke2.png" } + } + } + + Type { + name: "QtQuick3D.Particle3D.ParticleSystem3D" + icon: "images/dummy16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Fire" + category: "Qt Quick 3D Particle Effects" + libraryIcon: "images/dummy.png" + version: "6.2" + requiredImport: "QtQuick3D.ParticleEffects" + QmlSource { source: "./source/particleeffect_fire.qml" } + ExtraFile { source: "images/smoke_sprite.png" } + ExtraFile { source: "images/sphere.png" } + ExtraFile { source: "images/color_table.png" } + ExtraFile { source: "images/color_table2.png" } + } + } + + Type { + name: "QtQuick3D.Particle3D.ParticleSystem3D" + icon: "images/dummy16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Heavy Rain" + category: "Qt Quick 3D Particle Effects" + libraryIcon: "images/dummy.png" + version: "6.2" + requiredImport: "QtQuick3D.ParticleEffects" + QmlSource { source: "./source/particleeffect_heavyrain.qml" } + ExtraFile { source: "images/rain.png" } + ExtraFile { source: "images/sphere.png" } + ExtraFile { source: "images/ripple.png" } + ExtraFile { source: "images/splash7.png" } + } + } + + Type { + name: "QtQuick3D.Particle3D.ParticleSystem3D" + icon: "images/dummy16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Heavy Rain - Tire Spray" + category: "Qt Quick 3D Particle Effects" + libraryIcon: "images/dummy.png" + version: "6.2" + requiredImport: "QtQuick3D.ParticleEffects" + QmlSource { source: "./source/particleeffect_heavyrain_tirespray.qml" } + ExtraFile { source: "images/smoke2.png" } + } + } + + Type { + name: "QtQuick3D.Particle3D.ParticleSystem3D" + icon: "images/dummy16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Light Rain" + category: "Qt Quick 3D Particle Effects" + libraryIcon: "images/dummy.png" + version: "6.2" + requiredImport: "QtQuick3D.ParticleEffects" + QmlSource { source: "./source/particleeffect_lightrain.qml" } + ExtraFile { source: "images/rain.png" } + ExtraFile { source: "images/splash7.png" } + } + } + Type { + name: "QtQuick3D.Particle3D.ParticleSystem3D" + icon: "images/dummy16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Light Rain - Tire Spray" + category: "Qt Quick 3D Particle Effects" + libraryIcon: "images/dummy.png" + version: "6.2" + requiredImport: "QtQuick3D.ParticleEffects" + QmlSource { source: "./source/particleeffect_lightrain_tirespray.qml" } + ExtraFile { source: "images/smoke2.png" } + } + } + Type { + name: "QtQuick3D.Particle3D.ParticleSystem3D" + icon: "images/dummy16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Rain Mist" + category: "Qt Quick 3D Particle Effects" + libraryIcon: "images/dummy.png" + version: "6.2" + requiredImport: "QtQuick3D.ParticleEffects" + QmlSource { source: "./source/particleeffect_rainmist.qml" } + ExtraFile { source: "images/smoke2.png" } + } + } + Type { + name: "QtQuick3D.Particle3D.ParticleSystem3D" + icon: "images/dummy16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Snow" + category: "Qt Quick 3D Particle Effects" + libraryIcon: "images/dummy.png" + version: "6.2" + requiredImport: "QtQuick3D.ParticleEffects" + QmlSource { source: "./source/particleeffect_snow.qml" } + ExtraFile { source: "images/snowflake.png" } + } + } + Type { + name: "QtQuick3D.Particle3D.ParticleSystem3D" + icon: "images/dummy16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Steam" + category: "Qt Quick 3D Particle Effects" + libraryIcon: "images/dummy.png" + version: "6.2" + requiredImport: "QtQuick3D.ParticleEffects" + QmlSource { source: "./source/particleeffect_steam.qml" } + ExtraFile { source: "images/smoke2.png" } + } + } +} diff --git a/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick3D/Particles3D/designer/particles3d.metainfo b/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick3D/Particles3D/designer/particles3d.metainfo new file mode 100644 index 0000000000..d2a2999c50 --- /dev/null +++ b/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick3D/Particles3D/designer/particles3d.metainfo @@ -0,0 +1,562 @@ +MetaInfo { + Type { + name: "QtQuick3D.Particles3D.Attractor3D" + icon: "images/attractor-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Attractor" + category: "Qt Quick 3D Particles 3D" + libraryIcon: "images/attractor-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + } + } + Type { + name: "QtQuick3D.Particles3D.DynamicBurst3D" + icon: "images/emit-burst-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Dynamic Burst" + category: "Qt Quick 3D Particles 3D" + libraryIcon: "images/emit-burst-24px.png" + version: "6.3" + requiredImport: "QtQuick3D.Particles3D" + } + } + Type { + name: "QtQuick3D.Particles3D.EmitBurst3D" + icon: "images/emit-burst-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Emit Burst" + category: "Qt Quick 3D Particles 3D" + libraryIcon: "images/emit-burst-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + } + } + Type { + name: "QtQuick3D.Particles3D.ParticleEmitter3D" + icon: "images/emitter-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Emitter" + category: "Qt Quick 3D Particles 3D" + libraryIcon: "images/emitter-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + } + } + Type { + name: "QtQuick3D.Particles3D.Gravity3D" + icon: "images/gravity-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Gravity" + category: "Qt Quick 3D Particles 3D" + libraryIcon: "images/gravity-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + } + } + Type { + name: "QtQuick3D.Particles3D.ModelBlendParticle3D" + icon: "images/model-blend-particle-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Model Blend Particle" + category: "Qt Quick 3D Particles 3D" + libraryIcon: "images/model-blend-particle-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + } + } + Type { + name: "QtQuick3D.Particles3D.ModelParticle3D" + icon: "images/model-particle-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Model Particle" + category: "Qt Quick 3D Particles 3D" + libraryIcon: "images/model-particle-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + } + } + Type { + name: "QtQuick3D.Particles3D.ParticleCustomShape3D" + icon: "images/particle-custom-shape-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Custom Shape" + category: "Qt Quick 3D Particles 3D" + libraryIcon: "images/particle-custom-shape-24px.png" + version: "6.3" + requiredImport: "QtQuick3D.Particles3D" + } + } + Type { + name: "QtQuick3D.Particles3D.ParticleModelShape3D" + icon: "images/model-shape-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Model Shape" + category: "Qt Quick 3D Particles 3D" + libraryIcon: "images/model-shape-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + } + } + Type { + name: "QtQuick3D.Particles3D.PointRotator3D" + icon: "images/point-rotator-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Point Rotator" + category: "Qt Quick 3D Particles 3D" + libraryIcon: "images/point-rotator-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + } + } + Type { + name: "QtQuick3D.Particles3D.ParticleShape3D" + icon: "images/particle-shape-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Particle Shape" + category: "Qt Quick 3D Particles 3D" + libraryIcon: "images/particle-shape-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + } + } + Type { + name: "QtQuick3D.Particles3D.SpriteParticle3D" + icon: "images/sprite-particle-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Sprite Particle" + category: "Qt Quick 3D Particles 3D" + libraryIcon: "images/sprite-particle-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + } + } + Type { + name: "QtQuick3D.Particles3D.SpriteSequence3D" + icon: "images/sprite-sequence-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Sprite Sequence" + category: "Qt Quick 3D Particles 3D" + libraryIcon: "images/sprite-sequence-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + } + } + Type { + name: "QtQuick3D.Particles3D.ParticleSystem3D" + icon: "images/particle-system-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Particle System" + category: "Qt Quick 3D Particles 3D" + libraryIcon: "images/particle-system-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + QmlSource { source: "./source/particlesystem_template.qml" } + } + } + Type { + name: "QtQuick3D.Particles3D.TargetDirection3D" + icon: "images/target-direction-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Target Direction" + category: "Qt Quick 3D Particles 3D" + libraryIcon: "images/target-direction-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + } + } + Type { + name: "QtQuick3D.Particles3D.TrailEmitter3D" + icon: "images/trail-emitter-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Trail Emitter" + category: "Qt Quick 3D Particles 3D" + libraryIcon: "images/trail-emitter-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + } + } + Type { + name: "QtQuick3D.Particles3D.VectorDirection3D" + icon: "images/vector-direction-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Vector Direction" + category: "Qt Quick 3D Particles 3D" + libraryIcon: "images/vector-direction-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + } + } + Type { + name: "QtQuick3D.Particles3D.Wander3D" + icon: "images/wander-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Wander" + category: "Qt Quick 3D Particles 3D" + libraryIcon: "images/wander-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + } + } + Type { + name: "QtQuick3D.Particles3D.ParticleSystem3D" + icon: "images/particle-system-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Animated Sprite" + category: "Qt Quick 3D Particle System Templates" + libraryIcon: "images/particle-system-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + QmlSource { source: "./source/particlesystem_animatedsprite_template.qml" } + } + } + Type { + name: "QtQuick3D.Particles3D.ParticleSystem3D" + icon: "images/particle-system-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Attractor System" + category: "Qt Quick 3D Particle System Templates" + libraryIcon: "images/particle-system-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + QmlSource { source: "./source/particlesystem_attractor_template.qml" } + } + } + Type { + name: "QtQuick3D.Particles3D.ParticleSystem3D" + icon: "images/particle-system-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Burst" + category: "Qt Quick 3D Particle System Templates" + libraryIcon: "images/particle-system-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + QmlSource { source: "./source/particlesystem_burst_template.qml" } + } + } + Type { + name: "QtQuick3D.Particles3D.ParticleSystem3D" + icon: "images/particle-system-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Model Blend" + category: "Qt Quick 3D Particle System Templates" + libraryIcon: "images/particle-system-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + QmlSource { source: "./source/particlesystem_modelblend_template.qml" } + } + } + Type { + name: "QtQuick3D.Particles3D.ParticleSystem3D" + icon: "images/particle-system-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Model Shape" + category: "Qt Quick 3D Particle System Templates" + libraryIcon: "images/particle-system-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + QmlSource { source: "./source/particlesystem_modelshape_template.qml" } + } + } + Type { + name: "QtQuick3D.Particles3D.ParticleSystem3D" + icon: "images/particle-system-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Particle Trail" + category: "Qt Quick 3D Particle System Templates" + libraryIcon: "images/particle-system-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + QmlSource { source: "./source/particlesystem_particletrail_template.qml" } + } + } + Type { + name: "QtQuick3D.Particles3D.ParticleSystem3D" + icon: "images/particle-system-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Sprite" + category: "Qt Quick 3D Particle System Templates" + libraryIcon: "images/particle-system-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + QmlSource { source: "./source/particlesystem_sprite_template.qml" } + } + } + Type { + name: "QtQuick3D.Particles3D.ParticleSystem3D" + icon: "images/particle-system-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Wander" + category: "Qt Quick 3D Particle System Templates" + libraryIcon: "images/particle-system-24px.png" + version: "6.2" + requiredImport: "QtQuick3D.Particles3D" + QmlSource { source: "./source/particlesystem_wander_template.qml" } + } + } + Type { + name: "QtQuick3D.Particles3D.LineParticle3D" + icon: "images/line-particle-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Line Particle" + category: "Qt Quick 3D Particles 3D" + libraryIcon: "images/line-particle-24px.png" + version: "6.4" + requiredImport: "QtQuick3D.Particles3D" + } + } + Type { + name: "QtQuick3D.Particles3D.Repeller3D" + icon: "images/repeller-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Repeller" + category: "Qt Quick 3D Particles 3D" + libraryIcon: "images/repeller-24px.png" + version: "6.4" + requiredImport: "QtQuick3D.Particles3D" + } + } + Type { + name: "QtQuick3D.Particles3D.ScaleAffector3D" + icon: "images/scale-affector-16px.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Scale Affector" + category: "Qt Quick 3D Particles 3D" + libraryIcon: "images/scale-affector-24px.png" + version: "6.4" + requiredImport: "QtQuick3D.Particles3D" + } + } +} diff --git a/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick3D/Physics/designer/physics.metainfo b/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick3D/Physics/designer/physics.metainfo new file mode 100644 index 0000000000..874e209dc5 --- /dev/null +++ b/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick3D/Physics/designer/physics.metainfo @@ -0,0 +1,261 @@ +MetaInfo { + Type { + name: "QtQuick3D.Physics.PhysicsWorld" + icon: "images/physicsworld16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Physics World" + category: "Components" + libraryIcon: "images/physicsworld.png" + version: "6.5" + requiredImport: "QtQuick3D.Physics" + } + } + + Type { + name: "QtQuick3D.Physics.TriggerBody" + icon: "images/triggerbody16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Trigger Body" + category: "Collision Bodies" + libraryIcon: "images/triggerbody.png" + version: "6.5" + requiredImport: "QtQuick3D.Physics" + } + } + + Type { + name: "QtQuick3D.Physics.StaticRigidBody" + icon: "images/staticrigidbody16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Static Rigid Body" + category: "Collision Bodies" + libraryIcon: "images/staticrigidbody.png" + version: "6.5" + requiredImport: "QtQuick3D.Physics" + } + } + + Type { + name: "QtQuick3D.Physics.DynamicRigidBody" + icon: "images/dynamicrigidbody16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Dynamic Rigid Body" + category: "Collision Bodies" + libraryIcon: "images/dynamicrigidbody.png" + version: "6.5" + requiredImport: "QtQuick3D.Physics" + } + } + + Type { + name: "QtQuick3D.Physics.PhysicsMaterial" + icon: "images/physicsmaterial16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Physics Material" + category: "Components" + libraryIcon: "images/physicsmaterial.png" + version: "6.5" + requiredImport: "QtQuick3D.Physics" + } + } + + Type { + name: "QtQuick3D.Physics.BoxShape" + icon: "images/boxshape16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Box Shape" + category: "Collision Shapes" + libraryIcon: "images/boxshape.png" + version: "6.5" + requiredImport: "QtQuick3D.Physics" + } + } + + Type { + name: "QtQuick3D.Physics.CapsuleShape" + icon: "images/capsuleshape16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Capsule Shape" + category: "Collision Shapes" + libraryIcon: "images/capsuleshape.png" + version: "6.5" + requiredImport: "QtQuick3D.Physics" + } + } + + Type { + name: "QtQuick3D.Physics.ConvexMeshShape" + icon: "images/convexmeshshape16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Convex Mesh Shape" + category: "Collision Shapes" + libraryIcon: "images/convexmeshshape.png" + version: "6.5" + requiredImport: "QtQuick3D.Physics" + } + } + + Type { + name: "QtQuick3D.Physics.HeightFieldShape" + icon: "images/heightfieldshape16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Height Field Shape" + category: "Collision Shapes" + libraryIcon: "images/heightfieldshape.png" + version: "6.5" + requiredImport: "QtQuick3D.Physics" + } + } + + Type { + name: "QtQuick3D.Physics.PlaneShape" + icon: "images/planeshape16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Plane Shape" + category: "Collision Shapes" + libraryIcon: "images/planeshape.png" + version: "6.5" + requiredImport: "QtQuick3D.Physics" + } + } + + Type { + name: "QtQuick3D.Physics.SphereShape" + icon: "images/sphereshape16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Sphere Shape" + category: "Collision Shapes" + libraryIcon: "images/sphereshape.png" + version: "6.5" + requiredImport: "QtQuick3D.Physics" + } + } + + Type { + name: "QtQuick3D.Physics.TriangleMeshShape" + icon: "images/trianglemeshshape16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Triangle Mesh Shape" + category: "Collision Shapes" + libraryIcon: "images/trianglemeshshape.png" + version: "6.5" + requiredImport: "QtQuick3D.Physics" + } + } + + Type { + name: "QtQuick3D.Physics.CharacterController" + icon: "images/charactercontroller16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Character Controller" + category: "Collision Bodies" + libraryIcon: "images/charactercontroller.png" + version: "6.5" + requiredImport: "QtQuick3D.Physics" + } + } +} diff --git a/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick3D/designer/quick3d.metainfo b/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick3D/designer/quick3d.metainfo new file mode 100644 index 0000000000..852f908129 --- /dev/null +++ b/tests/unit/tests/unittests/projectstorage/data/qml/QtQuick3D/designer/quick3d.metainfo @@ -0,0 +1,861 @@ +MetaInfo { + Type { + name: "QtQuick3D.PerspectiveCamera" + icon: "images/camera16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Perspective Camera" + category: "Cameras" + libraryIcon: "images/camera.png" + version: "6.0" + requiredImport: "QtQuick3D" + Property { name: "z"; type: "int"; value: 500; } + toolTip: qsTr("A camera that uses perspective projection.") + } + } + Type { + name: "QtQuick3D.OrthographicCamera" + icon: "images/camera16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Orthographic Camera" + category: "Cameras" + libraryIcon: "images/camera.png" + version: "6.0" + requiredImport: "QtQuick3D" + Property { name: "z"; type: "int"; value: 500; } + toolTip: qsTr("A parallel projection Camera, in which an object's perceived scale is unaffected by its distance from the Camera.") + } + } + Type { + name: "QtQuick3D.FrustumCamera" + icon: "images/camera16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Frustum Camera" + category: "Cameras" + libraryIcon: "images/camera.png" + version: "6.0" + requiredImport: "QtQuick3D" + Property { name: "z"; type: "int"; value: 500; } + toolTip: qsTr("A perspective camera with a custom frustum.") + } + } + Type { + name: "QtQuick3D.CustomCamera" + icon: "images/camera16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Custom Camera" + category: "Cameras" + libraryIcon: "images/camera.png" + version: "6.0" + requiredImport: "QtQuick3D" + Property { name: "z"; type: "int"; value: 500; } + toolTip: qsTr("A camera with a custom projection matrix.") + } + } + Type { + name: "QtQuick3D.CustomMaterial" + icon: "images/custommaterial16.png" + + Hints { + visibleInNavigator: false + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Custom Material" + category: "Materials" + libraryIcon: "images/custommaterial.png" + version: "6.0" + requiredImport: "QtQuick3D" + Property { name: "fragmentShader"; type: "QUrl"; value: "custom_material_default_shader.frag"; } + ExtraFile { source: "source/custom_material_default_shader.frag" } + toolTip: qsTr("A material with customizable vertex and fragment shaders.") + } + } + Type { + name: "QtQuick3D.DefaultMaterial" + icon: "images/material16.png" + + Hints { + visibleInNavigator: false + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Default Material" + category: "Materials" + libraryIcon: "images/material.png" + version: "6.0" + requiredImport: "QtQuick3D" + Property { name: "diffuseColor"; type: "color"; value: "#4aee45"; } + toolTip: qsTr("A material with a specular/glossiness properties.") + } + } + Type { + name: "QtQuick3D.PrincipledMaterial" + icon: "images/material16.png" + + Hints { + visibleInNavigator: false + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Principled Material" + category: "Materials" + libraryIcon: "images/material.png" + version: "6.0" + requiredImport: "QtQuick3D" + Property { name: "baseColor"; type: "color"; value: "#4aee45"; } + toolTip: qsTr("A material with a PBR metal/roughness properties.") + } + } + Type { + name: "QtQuick3D.SpecularGlossyMaterial" + icon: "images/material16.png" + + Hints { + visibleInNavigator: false + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Specular Glossy" + category: "Materials" + libraryIcon: "images/material.png" + version: "6.4" + requiredImport: "QtQuick3D" + Property { name: "albedoColor"; type: "color"; value: "#4aee45"; } + Property { name: "specularColor"; type: "color"; value: "#000000"; } + toolTip: qsTr("A material with a PBR specular/glossiness properties.") + } + } + Type { + name: "QtQuick3D.Texture" + icon: "images/texture16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeContainer: false + } + + ItemLibraryEntry { + name: "Texture" + category: "Textures" + libraryIcon: "images/texture.png" + version: "6.0" + requiredImport: "QtQuick3D" + toolTip: qsTr("Defines a texture for 3D objects.") + } + } + Type { + name: "QtQuick3D.CubeMapTexture" + icon: "images/cubemaptexture16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeContainer: false + } + + ItemLibraryEntry { + name: "Cube Map Texture" + category: "Textures" + libraryIcon: "images/cubemaptexture.png" + version: "6.4" + requiredImport: "QtQuick3D" + toolTip: qsTr("Defines a cube map texture for 3D objects.") + } + } + Type { + name: "QtQuick3D.DirectionalLight" + icon: "images/lightdirectional16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Directional Light" + category: "Lights" + libraryIcon: "images/lightdirectional.png" + version: "6.0" + requiredImport: "QtQuick3D" + toolTip: qsTr("A light similar to sunlight. It emits light in one direction from an infinitely far away source.") + } + } + Type { + name: "QtQuick3D.PointLight" + icon: "images/lightpoint16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Point Light" + category: "Lights" + libraryIcon: "images/lightpoint.png" + version: "6.0" + requiredImport: "QtQuick3D" + toolTip: qsTr("A light similar to a light bulb. It emits light equally in all directions from a central source.") + } + } + Type { + name: "QtQuick3D.SpotLight" + icon: "images/lightspot16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Spotlight" + category: "Lights" + libraryIcon: "images/lightspot.png" + version: "6.0" + requiredImport: "QtQuick3D" + toolTip: qsTr("A spotlight emits light in one direction in a cone shape.") + } + } + Type { + name: "QtQuick3D.Model" + icon: "images/model16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + visibleNonDefaultProperties: "materials" + } + + ItemLibraryEntry { + name: "Model" + category: "Components" + libraryIcon: "images/group.png" + version: "6.0" + requiredImport: "QtQuick3D" + toolTip: qsTr("Allows you to load 3D mesh data.") + } + } + Type { + name: "QtQuick3D.Model" + icon: "images/model16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + visibleNonDefaultProperties: "materials" + } + + ItemLibraryEntry { + name: "Cube" + category: "Primitives" + libraryIcon: "images/cube.png" + version: "6.0" + requiredImport: "QtQuick3D" + Property { name: "source"; type: "QUrl"; value: "#Cube"; } + toolTip: qsTr("A cube model.") + } + } + Type { + name: "QtQuick3D.Model" + icon: "images/model16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + visibleNonDefaultProperties: "materials" + } + + ItemLibraryEntry { + name: "Sphere" + category: "Primitives" + libraryIcon: "images/sphere.png" + version: "6.0" + requiredImport: "QtQuick3D" + Property { name: "source"; type: "QUrl"; value: "#Sphere"; } + toolTip: qsTr("A sphere model.") + } + } + Type { + name: "QtQuick3D.Model" + icon: "images/model16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + visibleNonDefaultProperties: "materials" + } + + ItemLibraryEntry { + name: "Cylinder" + category: "Primitives" + libraryIcon: "images/cylinder.png" + version: "6.0" + requiredImport: "QtQuick3D" + Property { name: "source"; type: "QUrl"; value: "#Cylinder"; } + toolTip: qsTr("A cylinder model.") + } + } + Type { + name: "QtQuick3D.Model" + icon: "images/model16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + visibleNonDefaultProperties: "materials" + } + + ItemLibraryEntry { + name: "Plane" + category: "Primitives" + libraryIcon: "images/plane.png" + version: "6.0" + requiredImport: "QtQuick3D" + Property { name: "source"; type: "QUrl"; value: "#Rectangle"; } + toolTip: qsTr("A plane model.") + } + } + Type { + name: "QtQuick3D.Model" + icon: "images/model16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + visibleNonDefaultProperties: "materials" + } + + ItemLibraryEntry { + name: "Cone" + category: "Primitives" + libraryIcon: "images/cone.png" + version: "6.0" + requiredImport: "QtQuick3D" + Property { name: "source"; type: "QUrl"; value: "#Cone"; } + toolTip: qsTr("A cone model.") + } + } + Type { + name: "QtQuick3D.Node" + icon: "images/group16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Group" + category: "Components" + libraryIcon: "images/group.png" + version: "6.0" + requiredImport: "QtQuick3D" + toolTip: qsTr("A container to keep several QtQuick3D components or scenes together.") + } + } + Type { + name: "QtQuick3D.SceneEnvironment" + icon: "images/scene16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Scene Environment" + category: "Components" + libraryIcon: "images/scene.png" + version: "6.0" + requiredImport: "QtQuick3D" + toolTip: qsTr("Configures the render settings for a scene.") + } + } + Type { + name: "QtQuick3D.View3D" + icon: "images/view3D16.png" + + ItemLibraryEntry { + name: "View3D" + category: "Items" + libraryIcon: "images/view3D.png" + version: "6.0" + requiredImport: "QtQuick3D" + QmlSource { source: "./source/view3D_template.qml" } + toolTip: qsTr("A 2D surface where a 3D scene can be rendered.") + } + } + Type { + name: "QtQuick3D.Shader" + icon: "images/shaderutil16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Shader" + category: "Custom Shader Utils" + libraryIcon: "images/shaderutil.png" + version: "6.0" + requiredImport: "QtQuick3D" + toolTip: qsTr("A container for keeping the vertex or fragment shader codes to be used by post-processing effect.") + } + } + Type { + name: "QtQuick3D.TextureInput" + icon: "images/shaderutil16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Texture Input" + category: "Custom Shader Utils" + libraryIcon: "images/shaderutil.png" + version: "6.0" + requiredImport: "QtQuick3D" + toolTip: qsTr("Specifies a texture that gets exposed to the shader.") + } + } + Type { + name: "QtQuick3D.Pass" + icon: "images/shaderutil16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Pass" + category: "Custom Shader Utils" + libraryIcon: "images/shaderutil.png" + version: "6.0" + requiredImport: "QtQuick3D" + toolTip: qsTr("Holds a set of actions combining a list of executable render commands, an output buffer, and a list of shaders to use for rendering effects.") + } + } + Type { + name: "QtQuick3D.BufferInput" + icon: "images/shadercommand16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Buffer Input" + category: "Custom Shader Utils" + libraryIcon: "images/shadercommand.png" + version: "6.0" + requiredImport: "QtQuick3D" + toolTip: qsTr("A command that gets added to the list of commands in the Pass of an Effect when executed.") + } + } + Type { + name: "QtQuick3D.Buffer" + icon: "images/shaderutil16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Buffer" + category: "Custom Shader Utils" + libraryIcon: "images/shaderutil.png" + version: "6.0" + requiredImport: "QtQuick3D" + toolTip: qsTr("Creates or references a color buffer to be used for a pass of an Effect.") + } + } + Type { + name: "QtQuick3D.SetUniformValue" + icon: "images/shadercommand16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Set Uniform Value" + category: "Custom Shader Utils" + libraryIcon: "images/shadercommand.png" + version: "6.0" + requiredImport: "QtQuick3D" + toolTip: qsTr("A value that would be set when a single pass actions takes place.") + } + } + Type { + name: "QtQuick3D.Effect" + icon: "images/effect16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Effect" + category: "Components" + libraryIcon: "images/effect.png" + version: "6.0" + requiredImport: "QtQuick3D" + QmlSource { source: "./source/effect_template.qml" } + ExtraFile { source: "./source/effect_default_shader.frag" } + toolTip: qsTr("A method to allow the user to implement their post-processing effects on entire View3D.") + } + } + Type { + name: "QtQuick3D.Repeater3D" + icon: "images/repeater3d16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "3D Repeater" + category: "Components" + libraryIcon: "images/repeater3d.png" + version: "6.0" + requiredImport: "QtQuick3D" + toolTip: qsTr("Dynamically creates several copies of the same 3D object.") + } + } + Type { + name: "QtQuick3D.Loader3D" + icon: "images/loader3d16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Loader3D" + category: "Components" + libraryIcon: "images/loader3d.png" + version: "6.0" + requiredImport: "QtQuick3D" + toolTip: qsTr("Allows you to load 3D components dynamically.") + } + } + Type { + name: "QtQuick3D.Skeleton" + icon: "images/skeleton16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Skeleton" + category: "Components" + libraryIcon: "images/skeleton.png" + version: "6.0" + requiredImport: "QtQuick3D" + toolTip: qsTr("Defines a skeletal animation hierarchy.") + } + } + Type { + name: "QtQuick3D.MorphTarget" + icon: "images/morphtarget16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Morph Target" + category: "Components" + libraryIcon: "images/morphtarget.png" + version: "6.0" + requiredImport: "QtQuick3D" + toolTip: qsTr("Defines the properties of a morph target.") + } + } + Type { + name: "QtQuick3D.InstanceListEntry" + icon: "images/instancelistentry16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Instance List Entry" + category: "Components" + libraryIcon: "images/instancelistentry.png" + version: "6.2" + requiredImport: "QtQuick3D" + toolTip: qsTr("One instance in an Instance List. The instance includes a set of property specifications.") + } + } + Type { + name: "QtQuick3D.InstanceList" + icon: "images/instancelist16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Instance List" + category: "Components" + libraryIcon: "images/instancelist.png" + version: "6.2" + requiredImport: "QtQuick3D" + toolTip: qsTr("Enables 3D model instancing, a lightweight 3D object replication method.") + } + } + Type { + name: "QtQuick3D.FileInstancing" + icon: "images/fileinstancing16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "File Instancing" + category: "Components" + libraryIcon: "images/fileinstancing.png" + version: "6.2" + requiredImport: "QtQuick3D" + toolTip: qsTr("A method that allows reading instance tables from XML or Qt-specific binary files.") + } + } + Type { + name: "QtQuick3D.Joint" + icon: "images/joint16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + } + + ItemLibraryEntry { + name: "Joint" + category: "Components" + libraryIcon: "images/joint.png" + version: "6.0" + requiredImport: "QtQuick3D" + toolTip: qsTr("A transformable node that connects different parts in a skeletal animation.") + } + } + Type { + name: "QtQuick3D.ReflectionProbe" + icon: "images/reflectionProbe16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: true + } + + ItemLibraryEntry { + name: "Reflection Probe" + category: "Components" + libraryIcon: "images/reflectionProbe.png" + version: "6.3" + requiredImport: "QtQuick3D" + toolTip: qsTr("Reflects the current scene to the objects.") + } + } + Type { + name: "QtQuick3D.Fog" + icon: "images/fog16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Fog" + category: "Components" + libraryIcon: "images/fog.png" + version: "6.5" + requiredImport: "QtQuick3D" + } + } + Type { + name: "QtQuick3D.DebugSettings" + icon: "images/debugsettings16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Debug Settings" + category: "Components" + libraryIcon: "images/debugsettings.png" + version: "6.5" + requiredImport: "QtQuick3D" + } + } + + Type { + name: "QtQuick3D.Lightmapper" + icon: "images/lightmapper16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + // Split the name to avoid ellipsis in UI + name: "Light Mapper" + category: "Components" + libraryIcon: "images/lightmapper.png" + version: "6.5" + requiredImport: "QtQuick3D" + } + } + + Type { + name: "QtQuick3D.Skin" + icon: "images/skin16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Skin" + category: "Components" + libraryIcon: "images/skin.png" + version: "6.5" + requiredImport: "QtQuick3D" + } + } + + Type { + name: "QtQuick3D.ResourceLoader" + icon: "images/resourceLoader16.png" + + Hints { + visibleInNavigator: true + canBeDroppedInNavigator: true + canBeDroppedInFormEditor: false + canBeDroppedInView3D: false + } + + ItemLibraryEntry { + name: "Resource Loader" + category: "Components" + libraryIcon: "images/resourceLoader.png" + version: "6.2" + requiredImport: "QtQuick3D" + toolTip: qsTr("Pre-load resources for 3D scene. It makes sure that large resources are available before rendering a frame.") + } + } +} diff --git a/tests/unit/tests/unittests/projectstorage/projectstorage-test.cpp b/tests/unit/tests/unittests/projectstorage/projectstorage-test.cpp index 125e8df3ae..d16e007cc0 100644 --- a/tests/unit/tests/unittests/projectstorage/projectstorage-test.cpp +++ b/tests/unit/tests/unittests/projectstorage/projectstorage-test.cpp @@ -996,10 +996,10 @@ protected: package.updatedSourceIds = {sourceId1, sourceId2, sourceId3}; - package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId, "QtObject", sourceId1, sourceIdPath); - package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId, "Item", sourceId2, sourceIdPath); - package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId, "Item3D", sourceId3, sourceIdPath); - package.updatedPropertyEditorQmlPathSourceIds.emplace_back(sourceIdPath); + package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId, "QtObject", sourceId1, sourceIdPath6); + package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId, "Item", sourceId2, sourceIdPath6); + package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId, "Item3D", sourceId3, sourceIdPath6); + package.updatedPropertyEditorQmlPathSourceIds.emplace_back(sourceIdPath6); return package; } @@ -1013,6 +1013,7 @@ protected: traits.visibleInLibrary = FlagIs::True; annotations.emplace_back(sourceId4, + sourceIdPath6, "Object", qmlModuleId, "/path/to/icon.png", @@ -1034,6 +1035,32 @@ protected: "properties":[["color", "color", "#blue"]]}])xy"); annotations.emplace_back(sourceId5, + sourceIdPath6, + "Item", + qtQuickModuleId, + "/path/to/quick.png", + traits, + R"xy({"canBeContainer": "true", "forceClip": "false"})xy", + R"xy([{"name":"Item", + "iconPath":"/path/icon3", + "category":"Advanced Items", + "import":"QtQuick", + "toolTip":"Item is an Object", + "properties":[["x", "double", 1], ["y", "double", 2]]}])xy"); + + return annotations; + } + + auto createExtendedTypeAnnotations() const + { + auto annotations = createTypeAnnotions(); + annotations.pop_back(); + TypeTraits traits{TypeTraitsKind::Reference}; + traits.canBeContainer = FlagIs::True; + traits.visibleInLibrary = FlagIs::True; + + annotations.emplace_back(sourceId5, + sourceIdPath1, "Item", qtQuickModuleId, "/path/to/quick.png", @@ -1109,7 +1136,6 @@ protected: protected: inline static std::unique_ptr<Sqlite::Database> static_database; Sqlite::Database &database = *static_database; - //Sqlite::Database database{"/tmp/aaaaa.db", Sqlite::JournalMode::Wal}; inline static std::unique_ptr<QmlDesigner::ProjectStorage<Sqlite::Database>> static_projectStorage; QmlDesigner::ProjectStorage<Sqlite::Database> &storage = *static_projectStorage; QmlDesigner::SourcePathCache<QmlDesigner::ProjectStorage<Sqlite::Database>> sourcePathCache{ @@ -1120,14 +1146,16 @@ protected: QmlDesigner::SourcePathView path4{"/path4/to"}; QmlDesigner::SourcePathView path5{"/path5/to"}; QmlDesigner::SourcePathView path6{"/path6/to"}; - QmlDesigner::SourcePathView pathPath{"/path6/."}; + QmlDesigner::SourcePathView pathPath1{"/path1/."}; + QmlDesigner::SourcePathView pathPath6{"/path6/."}; SourceId sourceId1{sourcePathCache.sourceId(path1)}; SourceId sourceId2{sourcePathCache.sourceId(path2)}; SourceId sourceId3{sourcePathCache.sourceId(path3)}; SourceId sourceId4{sourcePathCache.sourceId(path4)}; SourceId sourceId5{sourcePathCache.sourceId(path5)}; SourceId sourceId6{sourcePathCache.sourceId(path6)}; - SourceId sourceIdPath{sourcePathCache.sourceId(path6)}; + SourceId sourceIdPath1{sourcePathCache.sourceId(pathPath1)}; + SourceId sourceIdPath6{sourcePathCache.sourceId(pathPath6)}; SourceId qmlProjectSourceId{sourcePathCache.sourceId("/path1/qmldir")}; SourceId qtQuickProjectSourceId{sourcePathCache.sourceId("/path2/qmldir")}; ModuleId qmlModuleId{storage.moduleId("Qml")}; @@ -7276,7 +7304,7 @@ TEST_F(ProjectStorage, synchronize_property_editor_adds_path) auto package{createPropertyEditorPathsSynchronizationPackage()}; package.propertyEditorQmlPaths.pop_back(); storage.synchronize(package); - package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId, "Item3D", sourceId3, sourceIdPath); + package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId, "Item3D", sourceId3, sourceIdPath6); storage.synchronize(package); @@ -7288,7 +7316,7 @@ TEST_F(ProjectStorage, synchronize_property_editor_adds_path) TEST_F(ProjectStorage, synchronize_property_editor_with_non_existing_type_name) { auto package{createPropertyEditorPathsSynchronizationPackage()}; - package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId, "Item4D", sourceId4, sourceIdPath); + package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId, "Item4D", sourceId4, sourceIdPath6); storage.synchronize(package); @@ -7308,6 +7336,21 @@ TEST_F(ProjectStorage, call_remove_type_ids_in_observer_after_synchronization) storage.synchronize(package); } +TEST_F(ProjectStorage, do_not_synchronize_type_annotations_without_type) +{ + SynchronizationPackage package; + package.typeAnnotations = createTypeAnnotions(); + package.updatedTypeAnnotationSourceIds = createUpdatedTypeAnnotionSourceIds( + package.typeAnnotations); + TypeTraits traits{TypeTraitsKind::Reference}; + traits.canBeContainer = FlagIs::True; + traits.visibleInLibrary = FlagIs::True; + + storage.synchronize(package); + + ASSERT_THAT(storage.allItemLibraryEntries(), IsEmpty()); +} + TEST_F(ProjectStorage, synchronize_type_annotation_type_traits) { auto package{createSimpleSynchronizationPackage()}; @@ -7462,6 +7505,18 @@ TEST_F(ProjectStorage, synchronize_removes_type_hints) TEST_F(ProjectStorage, return_empty_type_hints_if_no_type_hints_exists) { auto package{createSimpleSynchronizationPackage()}; + package.typeAnnotations = createTypeAnnotions(); + package.typeAnnotations[0].hintsJson.clear(); + storage.synchronize(package); + + auto typeHints = storage.typeHints(fetchTypeId(sourceId2, "QObject")); + + ASSERT_THAT(typeHints, IsEmpty()); +} + +TEST_F(ProjectStorage, return_empty_type_hints_if_no_type_annotaion_exists) +{ + auto package{createSimpleSynchronizationPackage()}; storage.synchronize(package); auto typeHints = storage.typeHints(fetchTypeId(sourceId2, "QObject")); @@ -7534,7 +7589,7 @@ TEST_F(ProjectStorage, synchronize_removes_item_library_entries) ASSERT_THAT(storage.allItemLibraryEntries(), IsEmpty()); } -TEST_F(ProjectStorage, synchronize_udpates_item_library_entries) +TEST_F(ProjectStorage, synchronize_updates_item_library_entries) { auto package{createSimpleSynchronizationPackage()}; package.typeAnnotations = createTypeAnnotions(); @@ -7560,6 +7615,59 @@ TEST_F(ProjectStorage, synchronize_udpates_item_library_entries) IsEmpty()))); } +TEST_F(ProjectStorage, synchronize_updates_item_library_entries_with_empty_entries) +{ + auto package{createSimpleSynchronizationPackage()}; + package.typeAnnotations = createTypeAnnotions(); + package.updatedTypeAnnotationSourceIds = createUpdatedTypeAnnotionSourceIds( + package.typeAnnotations); + storage.synchronize(package); + package.typeAnnotations[0].itemLibraryJson.clear(); + + storage.synchronize(package); + + ASSERT_THAT(storage.itemLibraryEntries(fetchTypeId(sourceId2, "QObject")), IsEmpty()); +} + +TEST_F(ProjectStorage, synchronize_type_annotation_directory_source_id) +{ + auto package{createSimpleSynchronizationPackage()}; + package.typeAnnotations = createTypeAnnotions(); + package.updatedTypeAnnotationSourceIds = createUpdatedTypeAnnotionSourceIds( + package.typeAnnotations); + + storage.synchronize(package); + + ASSERT_THAT(storage.typeAnnotationSourceIds(sourceIdPath6), + UnorderedElementsAre(sourceId4, sourceId5)); +} + +TEST_F(ProjectStorage, get_type_annotation_source_ids) +{ + auto package{createSimpleSynchronizationPackage()}; + package.typeAnnotations = createTypeAnnotions(); + package.updatedTypeAnnotationSourceIds = createUpdatedTypeAnnotionSourceIds( + package.typeAnnotations); + storage.synchronize(package); + + auto sourceIds = storage.typeAnnotationSourceIds(sourceIdPath6); + + ASSERT_THAT(sourceIds, UnorderedElementsAre(sourceId4, sourceId5)); +} + +TEST_F(ProjectStorage, get_type_annotation_directory_source_ids) +{ + auto package{createSimpleSynchronizationPackage()}; + package.typeAnnotations = createExtendedTypeAnnotations(); + package.updatedTypeAnnotationSourceIds = createUpdatedTypeAnnotionSourceIds( + package.typeAnnotations); + storage.synchronize(package); + + auto sourceIds = storage.typeAnnotationDirectorySourceIds(); + + ASSERT_THAT(sourceIds, ElementsAre(sourceIdPath1, sourceIdPath6)); +} + TEST_F(ProjectStorage, get_all_item_library_entries) { auto package{createSimpleSynchronizationPackage()}; @@ -7605,6 +7713,31 @@ TEST_F(ProjectStorage, get_all_item_library_entries) IsEmpty()))); } +TEST_F(ProjectStorage, get_all_item_library_entries_handles_no_entries) +{ + auto package{createSimpleSynchronizationPackage()}; + package.typeAnnotations = createTypeAnnotions(); + package.typeAnnotations[0].itemLibraryJson.clear(); + package.updatedTypeAnnotationSourceIds = createUpdatedTypeAnnotionSourceIds( + package.typeAnnotations); + storage.synchronize(package); + + auto entries = storage.allItemLibraryEntries(); + + ASSERT_THAT(entries, + UnorderedElementsAre( + IsItemLibraryEntry(fetchTypeId(sourceId1, "QQuickItem"), + "Item", + "/path/icon3", + "Advanced Items", + "QtQuick", + "Item is an Object", + "", + UnorderedElementsAre(IsItemLibraryProperty("x", "double", 1), + IsItemLibraryProperty("y", "double", 2)), + IsEmpty()))); +} + TEST_F(ProjectStorage, get_item_library_entries_by_type_id) { auto package{createSimpleSynchronizationPackage()}; @@ -7654,6 +7787,21 @@ TEST_F(ProjectStorage, get_no_item_library_entries_if_type_id_is_invalid) ASSERT_THAT(entries, IsEmpty()); } +TEST_F(ProjectStorage, get_no_item_library_entries_by_type_id_for_no_entries) +{ + auto package{createSimpleSynchronizationPackage()}; + package.typeAnnotations = createTypeAnnotions(); + package.typeAnnotations[0].itemLibraryJson.clear(); + package.updatedTypeAnnotationSourceIds = createUpdatedTypeAnnotionSourceIds( + package.typeAnnotations); + storage.synchronize(package); + auto typeId = fetchTypeId(sourceId2, "QObject"); + + auto entries = storage.itemLibraryEntries(typeId); + + ASSERT_THAT(entries, IsEmpty()); +} + TEST_F(ProjectStorage, get_item_library_entries_by_source_id) { auto package{createSimpleSynchronizationPackage()}; @@ -7689,6 +7837,20 @@ TEST_F(ProjectStorage, get_item_library_entries_by_source_id) IsEmpty()))); } +TEST_F(ProjectStorage, get_no_item_library_entries_by_source_id_for_no_entries) +{ + auto package{createSimpleSynchronizationPackage()}; + package.typeAnnotations = createTypeAnnotions(); + package.typeAnnotations[0].itemLibraryJson.clear(); + package.updatedTypeAnnotationSourceIds = createUpdatedTypeAnnotionSourceIds( + package.typeAnnotations); + storage.synchronize(package); + + auto entries = storage.itemLibraryEntries(sourceId2); + + ASSERT_THAT(entries, IsEmpty()); +} + TEST_F(ProjectStorage, return_type_ids_for_module_id) { auto package{createBuiltinSynchronizationPackage()}; diff --git a/tests/unit/tests/unittests/projectstorage/projectstorageupdater-test.cpp b/tests/unit/tests/unittests/projectstorage/projectstorageupdater-test.cpp index a28c5e4935..a0ca901262 100644 --- a/tests/unit/tests/unittests/projectstorage/projectstorageupdater-test.cpp +++ b/tests/unit/tests/unittests/projectstorage/projectstorageupdater-test.cpp @@ -9,6 +9,8 @@ #include "../mocks/qmldocumentparsermock.h" #include "../mocks/qmltypesparsermock.h" +#include <projectstorage-matcher.h> + #include <projectstorage/filestatuscache.h> #include <projectstorage/projectstorage.h> #include <projectstorage/projectstorageupdater.h> @@ -120,7 +122,8 @@ MATCHER(PackageIsEmpty, std::string(negation ? "isn't empty" : "is empty")) && package.moduleDependencies.empty() && package.updatedModuleDependencySourceIds.empty() && package.moduleExportedImports.empty() && package.updatedModuleIds.empty() && package.propertyEditorQmlPaths.empty() - && package.updatedPropertyEditorQmlPathSourceIds.empty(); + && package.updatedPropertyEditorQmlPathSourceIds.empty() + && package.typeAnnotations.empty() && package.updatedTypeAnnotationSourceIds.empty(); } template<typename ModuleIdMatcher, typename TypeNameMatcher, typename SourceIdMatcher> @@ -168,7 +171,8 @@ public: secondSourceId, thirdSourceId, qmltypes1SourceId, - qmltypes2SourceId}); + qmltypes2SourceId, + itemLibraryPathSourceId}); setFilesAdded({qmldir1SourceId, qmldir2SourceId, qmldir3SourceId}); @@ -298,6 +302,8 @@ public: EXPECT_CALL(fileSystemMock, contentAsQString(Eq(path))).WillRepeatedly(Return(content)); } + auto moduleId(Utils::SmallStringView name) const { return storage.moduleId(name); } + protected: NiceMock<FileSystemMock> fileSystemMock; NiceMock<ProjectStorageMock> projectStorageMock; @@ -328,6 +334,13 @@ protected: SourceId qmlDocumentSourceId1 = sourcePathCache.sourceId("/path/First.qml"); SourceId qmlDocumentSourceId2 = sourcePathCache.sourceId("/path/First2.qml"); SourceId qmlDocumentSourceId3 = sourcePathCache.sourceId("/path/Second.qml"); + const QString itemLibraryPath = QDir::cleanPath( + UNITTEST_DIR "/../../../../share/qtcreator/qmldesigner/itemLibrary/"); + const QString qmlImportsPath = QDir::cleanPath(UNITTEST_DIR "/projectstorage/data/qml"); + SourceId itemLibraryPathSourceId = sourcePathCache.sourceId( + QmlDesigner::SourcePath{itemLibraryPath + "/."}); + SourceId qmlImportsPathSourceId = sourcePathCache.sourceId( + QmlDesigner::SourcePath{qmlImportsPath + "/."}); ModuleId qmlModuleId{storage.moduleId("Qml")}; ModuleId qmlCppNativeModuleId{storage.moduleId("Qml-cppnative")}; ModuleId exampleModuleId{storage.moduleId("Example")}; @@ -410,7 +423,7 @@ TEST_F(ProjectStorageUpdater, get_content_for_qml_dir_paths_if_file_status_is_di EXPECT_CALL(fileSystemMock, contentAsQString(Eq(QString("/path/one/qmldir")))); EXPECT_CALL(fileSystemMock, contentAsQString(Eq(QString("/path/two/qmldir")))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, request_file_status_from_file_system) @@ -419,7 +432,7 @@ TEST_F(ProjectStorageUpdater, request_file_status_from_file_system) EXPECT_CALL(fileSystemMock, fileStatus(Eq(directoryPathSourceId))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, get_content_for_qml_types) @@ -431,7 +444,7 @@ TEST_F(ProjectStorageUpdater, get_content_for_qml_types) EXPECT_CALL(fileSystemMock, contentAsQString(Eq(QString("/path/example.qmltypes")))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, get_content_for_qml_types_if_project_storage_file_status_is_invalid) @@ -444,7 +457,7 @@ TEST_F(ProjectStorageUpdater, get_content_for_qml_types_if_project_storage_file_ EXPECT_CALL(fileSystemMock, contentAsQString(Eq(QString("/path/example.qmltypes")))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, parse_qml_types) @@ -463,7 +476,7 @@ TEST_F(ProjectStorageUpdater, parse_qml_types) EXPECT_CALL(qmlTypesParserMock, parse(qmltypes2, _, _, Field(&ProjectData::moduleId, exampleCppNativeModuleId))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchronize_is_empty_for_no_change) @@ -472,7 +485,7 @@ TEST_F(ProjectStorageUpdater, synchronize_is_empty_for_no_change) EXPECT_CALL(projectStorageMock, synchronize(PackageIsEmpty())); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchronize_qml_types) @@ -507,7 +520,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_types) Field(&SynchronizationPackage::updatedProjectSourceIds, UnorderedElementsAre(directoryPathSourceId))))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchronize_qml_types_throws_if_qmltpes_does_not_exists) @@ -515,7 +528,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_types_throws_if_qmltpes_does_not_e Storage::Import import{qmlModuleId, Storage::Version{2, 3}, qmltypesPathSourceId}; setFilesDontExists({qmltypesPathSourceId}); - ASSERT_THROW(updater.update(directories, {}, {}), QmlDesigner::CannotParseQmlTypesFile); + ASSERT_THROW(updater.update(directories, {}, {}, {}), QmlDesigner::CannotParseQmlTypesFile); } TEST_F(ProjectStorageUpdater, synchronize_qml_types_are_empty_if_file_does_not_changed) @@ -528,7 +541,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_types_are_empty_if_file_does_not_c EXPECT_CALL(projectStorageMock, synchronize(PackageIsEmpty())); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, get_content_for_qml_documents) @@ -549,7 +562,7 @@ TEST_F(ProjectStorageUpdater, get_content_for_qml_documents) EXPECT_CALL(fileSystemMock, contentAsQString(Eq(QString("/path/OldSecond.qml")))); EXPECT_CALL(fileSystemMock, contentAsQString(Eq(QString("/path/Second.qml")))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, parse_qml_documents) @@ -570,7 +583,7 @@ TEST_F(ProjectStorageUpdater, parse_qml_documents) EXPECT_CALL(qmlDocumentParserMock, parse(qmlDocument2, _, _, _)); EXPECT_CALL(qmlDocumentParserMock, parse(qmlDocument3, _, _, _)); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, parse_qml_documents_with_non_existing_qml_document_throws) @@ -579,7 +592,7 @@ TEST_F(ProjectStorageUpdater, parse_qml_documents_with_non_existing_qml_document NonexitingType 1.0 NonexitingType.qml)"}; setContent(u"/path/qmldir", qmldir); - ASSERT_THROW(updater.update(directories, {}, {}), QmlDesigner::CannotParseQmlDocumentFile); + ASSERT_THROW(updater.update(directories, {}, {}, {}), QmlDesigner::CannotParseQmlDocumentFile); } TEST_F(ProjectStorageUpdater, synchronize_qml_documents) @@ -652,7 +665,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents) ModuleId{}, FileType::QmlDocument)))))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchronize_add_only_qml_document_in_directory) @@ -708,7 +721,7 @@ TEST_F(ProjectStorageUpdater, synchronize_add_only_qml_document_in_directory) ModuleId{}, FileType::QmlDocument)))))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchronize_removes_qml_document) @@ -771,7 +784,7 @@ TEST_F(ProjectStorageUpdater, synchronize_removes_qml_document) ModuleId{}, FileType::QmlDocument)))))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchronize_removes_qml_document_in_qmldir_only) @@ -826,7 +839,7 @@ TEST_F(ProjectStorageUpdater, synchronize_removes_qml_document_in_qmldir_only) ModuleId{}, FileType::QmlDocument)))))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchronize_add_qml_document_to_qmldir) @@ -884,7 +897,7 @@ TEST_F(ProjectStorageUpdater, synchronize_add_qml_document_to_qmldir) ModuleId{}, FileType::QmlDocument)))))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchronize_remove_qml_document_from_qmldir) @@ -939,7 +952,7 @@ TEST_F(ProjectStorageUpdater, synchronize_remove_qml_document_from_qmldir) ModuleId{}, FileType::QmlDocument)))))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchronize_qml_documents_dont_update_if_up_to_date) @@ -1009,7 +1022,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_dont_update_if_up_to_dat ModuleId{}, FileType::QmlDocument)))))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_has_not_changed) @@ -1060,7 +1073,7 @@ TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_has_not_changed) qmlDocumentSourceId2)), Field(&SynchronizationPackage::projectDatas, IsEmpty())))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_has_not_changed_and_some_updated_files) @@ -1095,7 +1108,7 @@ TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_has_not_changed_and_some UnorderedElementsAre(qmltypesPathSourceId, qmlDocumentSourceId1)), Field(&SynchronizationPackage::projectDatas, IsEmpty())))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_not_changed_and_some_removed_files) @@ -1110,7 +1123,7 @@ TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_not_changed_and_some_rem setFilesDontChanged({qmlDirPathSourceId, qmltypes2PathSourceId, qmlDocumentSourceId2}); setFilesRemoved({qmltypesPathSourceId, qmlDocumentSourceId1}); - ASSERT_THROW(updater.update(directories, {}, {}), QmlDesigner::CannotParseQmlTypesFile); + ASSERT_THROW(updater.update(directories, {}, {}, {}), QmlDesigner::CannotParseQmlTypesFile); } TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_has_changed_and_some_removed_files) @@ -1162,7 +1175,7 @@ TEST_F(ProjectStorageUpdater, synchroniz_if_qmldir_file_has_changed_and_some_rem exampleCppNativeModuleId, FileType::QmlTypes)))))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, update_qml_types_files_is_empty) @@ -1177,7 +1190,7 @@ TEST_F(ProjectStorageUpdater, update_qml_types_files_is_empty) Field(&SynchronizationPackage::projectDatas, IsEmpty()), Field(&SynchronizationPackage::updatedProjectSourceIds, IsEmpty())))); - updater.update({}, {}, {}); + updater.update({}, {}, {}, {}); } TEST_F(ProjectStorageUpdater, update_qml_types_files) @@ -1205,7 +1218,7 @@ TEST_F(ProjectStorageUpdater, update_qml_types_files) Field(&SynchronizationPackage::updatedProjectSourceIds, UnorderedElementsAre(qmltypesPathSourceId, qmltypes2PathSourceId))))); - updater.update({}, {"/path/example.qmltypes", "/path/example2.qmltypes"}, {}); + updater.update({}, {"/path/example.qmltypes", "/path/example2.qmltypes"}, {}, {}); } TEST_F(ProjectStorageUpdater, dont_update_qml_types_files_if_unchanged) @@ -1230,7 +1243,7 @@ TEST_F(ProjectStorageUpdater, dont_update_qml_types_files_if_unchanged) Field(&SynchronizationPackage::updatedProjectSourceIds, UnorderedElementsAre(qmltypesPathSourceId))))); - updater.update({}, {"/path/example.qmltypes", "/path/example2.qmltypes"}, {}); + updater.update({}, {"/path/example.qmltypes", "/path/example2.qmltypes"}, {}, {}); } TEST_F(ProjectStorageUpdater, synchronize_qml_documents_with_different_version_but_same_type_name_and_file_name) @@ -1273,7 +1286,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_with_different_version_b ModuleId{}, FileType::QmlDocument)))))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchronize_qml_documents_with_different_type_name_but_same_version_and_file_name) @@ -1314,7 +1327,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_with_different_type_name ModuleId{}, FileType::QmlDocument)))))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, dont_synchronize_selectors) @@ -1332,7 +1345,7 @@ TEST_F(ProjectStorageUpdater, dont_synchronize_selectors) Contains(Field(&Storage::Synchronization::Type::exportedTypes, Contains(IsExportedType(exampleModuleId, "FirstType", 1, 0)))))))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchronize_qmldir_dependencies) @@ -1357,7 +1370,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qmldir_dependencies) Field(&SynchronizationPackage::updatedModuleDependencySourceIds, UnorderedElementsAre(qmltypesPathSourceId, qmltypes2PathSourceId))))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchronize_qmldir_dependencies_with_double_entries) @@ -1383,7 +1396,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qmldir_dependencies_with_double_entrie Field(&SynchronizationPackage::updatedModuleDependencySourceIds, UnorderedElementsAre(qmltypesPathSourceId, qmltypes2PathSourceId))))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchronize_qmldir_dependencies_with_colliding_imports) @@ -1409,7 +1422,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qmldir_dependencies_with_colliding_imp Field(&SynchronizationPackage::updatedModuleDependencySourceIds, UnorderedElementsAre(qmltypesPathSourceId, qmltypes2PathSourceId))))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchronize_qmldir_with_no_dependencies) @@ -1426,7 +1439,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qmldir_with_no_dependencies) Field(&SynchronizationPackage::updatedModuleDependencySourceIds, UnorderedElementsAre(qmltypesPathSourceId, qmltypes2PathSourceId))))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchronize_qmldir_imports) @@ -1468,7 +1481,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qmldir_imports) Field(&SynchronizationPackage::updatedModuleIds, ElementsAre(exampleModuleId))))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchronize_qmldir_with_no_imports) @@ -1482,7 +1495,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qmldir_with_no_imports) Field(&SynchronizationPackage::updatedModuleIds, ElementsAre(exampleModuleId))))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchronize_qmldir_imports_with_double_entries) @@ -1525,7 +1538,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qmldir_imports_with_double_entries) Field(&SynchronizationPackage::updatedModuleIds, ElementsAre(exampleModuleId))))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchronize_qmldir_optional_imports) @@ -1567,7 +1580,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qmldir_optional_imports) Field(&SynchronizationPackage::updatedModuleIds, ElementsAre(exampleModuleId))))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, update_path_watcher_directories) @@ -1577,7 +1590,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_directories) QmlDesigner::SourceType::Directory, {path1SourceId, path2SourceId, path3SourceId}}))); - updater.update(directories3, {}, {}); + updater.update(directories3, {}, {}, {}); } TEST_F(ProjectStorageUpdater, update_path_watcher_directory_does_not_exists) @@ -1589,7 +1602,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_directory_does_not_exists) QmlDesigner::SourceType::Directory, {path1SourceId, path3SourceId}}))); - updater.update(directories3, {}, {}); + updater.update(directories3, {}, {}, {}); } TEST_F(ProjectStorageUpdater, update_path_watcher_directory_does_not_changed) @@ -1601,7 +1614,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_directory_does_not_changed) QmlDesigner::SourceType::Directory, {path1SourceId, path2SourceId}}))); - updater.update(directories2, {}, {}); + updater.update(directories2, {}, {}, {}); } TEST_F(ProjectStorageUpdater, update_path_watcher_directory_removed) @@ -1612,7 +1625,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_directory_removed) updateIdPaths(Contains( IdPaths{projectPartId, QmlDesigner::SourceType::Directory, {path2SourceId}}))); - updater.update(directories2, {}, {}); + updater.update(directories2, {}, {}, {}); } TEST_F(ProjectStorageUpdater, update_path_watcher_qmldirs) @@ -1622,7 +1635,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_qmldirs) QmlDesigner::SourceType::QmlDir, {qmldir1SourceId, qmldir2SourceId, qmldir3SourceId}}))); - updater.update(directories3, {}, {}); + updater.update(directories3, {}, {}, {}); } TEST_F(ProjectStorageUpdater, update_path_watcher_qmldir_does_not_exists) @@ -1634,7 +1647,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_qmldir_does_not_exists) QmlDesigner::SourceType::QmlDir, {qmldir1SourceId, qmldir3SourceId}}))); - updater.update(directories3, {}, {}); + updater.update(directories3, {}, {}, {}); } TEST_F(ProjectStorageUpdater, update_path_watcher_qmldir_does_not_changed) @@ -1646,7 +1659,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_qmldir_does_not_changed) QmlDesigner::SourceType::QmlDir, {qmldir1SourceId, qmldir2SourceId}}))); - updater.update(directories2, {}, {}); + updater.update(directories2, {}, {}, {}); } TEST_F(ProjectStorageUpdater, update_path_watcher_qmldir_removed) @@ -1657,7 +1670,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_qmldir_removed) updateIdPaths(Contains( IdPaths{projectPartId, QmlDesigner::SourceType::QmlDir, {qmldir2SourceId}}))); - updater.update(directories2, {}, {}); + updater.update(directories2, {}, {}, {}); } TEST_F(ProjectStorageUpdater, update_path_watcher_qml_files) @@ -1674,7 +1687,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_qml_files) QmlDesigner::SourceType::Qml, {firstSourceId, secondSourceId, thirdSourceId}}))); - updater.update(directories2, {}, {}); + updater.update(directories2, {}, {}, {}); } TEST_F(ProjectStorageUpdater, update_path_watcher_only_qml_files_dont_changed) @@ -1692,7 +1705,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_only_qml_files_dont_changed) QmlDesigner::SourceType::Qml, {firstSourceId, secondSourceId, thirdSourceId}}))); - updater.update(directories2, {}, {}); + updater.update(directories2, {}, {}, {}); } TEST_F(ProjectStorageUpdater, update_path_watcher_only_qml_files_changed) @@ -1710,7 +1723,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_only_qml_files_changed) QmlDesigner::SourceType::Qml, {firstSourceId, secondSourceId, thirdSourceId}}))); - updater.update(directories2, {}, {}); + updater.update(directories2, {}, {}, {}); } TEST_F(ProjectStorageUpdater, update_path_watcher_qml_files_and_directories_dont_changed) @@ -1733,7 +1746,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_qml_files_and_directories_dont QmlDesigner::SourceType::Qml, {firstSourceId, secondSourceId, thirdSourceId}}))); - updater.update(directories2, {}, {}); + updater.update(directories2, {}, {}, {}); } TEST_F(ProjectStorageUpdater, update_path_watcher_qmltypes_files_in_qmldir) @@ -1752,7 +1765,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_qmltypes_files_in_qmldir) QmlDesigner::SourceType::QmlTypes, {qmltypes1SourceId, qmltypes2SourceId}}))); - updater.update(directories2, {}, {}); + updater.update(directories2, {}, {}, {}); } TEST_F(ProjectStorageUpdater, update_path_watcher_only_qmltypes_files_in_qmldir_dont_changed) @@ -1770,7 +1783,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_only_qmltypes_files_in_qmldir_ QmlDesigner::SourceType::QmlTypes, {qmltypes1SourceId, qmltypes2SourceId}}))); - updater.update(directories2, {}, {}); + updater.update(directories2, {}, {}, {}); } TEST_F(ProjectStorageUpdater, update_path_watcher_only_qmltypes_files_changed) @@ -1787,7 +1800,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_only_qmltypes_files_changed) QmlDesigner::SourceType::QmlTypes, {qmltypes1SourceId, qmltypes2SourceId}}))); - updater.update(directories2, {}, {}); + updater.update(directories2, {}, {}, {}); } TEST_F(ProjectStorageUpdater, update_path_watcher_qmltypes_files_and_directories_dont_changed) @@ -1808,7 +1821,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_qmltypes_files_and_directories QmlDesigner::SourceType::QmlTypes, {qmltypes1SourceId, qmltypes2SourceId}}))); - updater.update(directories2, {}, {}); + updater.update(directories2, {}, {}, {}); } TEST_F(ProjectStorageUpdater, update_path_watcher_builtin_qmltypes_files) @@ -1823,7 +1836,7 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_builtin_qmltypes_files) QmlDesigner::SourceType::QmlTypes, {qmltypes1SourceId, qmltypes2SourceId}}))); - updater.update({}, {builtinQmltyplesPath1, builtinQmltyplesPath2}, {}); + updater.update({}, {builtinQmltyplesPath1, builtinQmltyplesPath2}, {}, {}); } TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir) @@ -1890,7 +1903,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir) ModuleId{}, FileType::QmlDocument)))))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir_throws_if_qml_document_does_not_exists) @@ -1898,7 +1911,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir_throws_if setFilesDontExists({qmlDirPathSourceId, qmlDocumentSourceId1}); setFilesAdded({directoryPathSourceId}); - ASSERT_THROW(updater.update(directories, {}, {}), QmlDesigner::CannotParseQmlDocumentFile); + ASSERT_THROW(updater.update(directories, {}, {}, {}), QmlDesigner::CannotParseQmlDocumentFile); } TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir_throws_if_directory_does_not_exists) @@ -1928,7 +1941,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir_throws_if UnorderedElementsAre(directoryPathSourceId)), Field(&SynchronizationPackage::projectDatas, IsEmpty())))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir_add_qml_document) @@ -1977,7 +1990,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir_add_qml_d ModuleId{}, FileType::QmlDocument)))))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir_removes_qml_document) @@ -2016,7 +2029,7 @@ TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir_removes_q ModuleId{}, FileType::QmlDocument)))))); - updater.update(directories, {}, {}); + updater.update(directories, {}, {}, {}); } TEST_F(ProjectStorageUpdater, watcher_updates_directories) @@ -3475,7 +3488,7 @@ TEST_F(ProjectStorageUpdater, update_property_editor_panes) Field(&SynchronizationPackage::updatedPropertyEditorQmlPathSourceIds, ElementsAre(directoryId))))); - updater.update({}, {}, propertyEditorQmlPath); + updater.update({}, {}, propertyEditorQmlPath, {}); } TEST_F(ProjectStorageUpdater, update_property_editor_specifics) @@ -3500,12 +3513,12 @@ TEST_F(ProjectStorageUpdater, update_property_editor_specifics) Field(&SynchronizationPackage::updatedPropertyEditorQmlPathSourceIds, ElementsAre(directoryId))))); - updater.update({}, {}, propertyEditorQmlPath); + updater.update({}, {}, propertyEditorQmlPath, {}); } TEST_F(ProjectStorageUpdater, update_property_editor_panes_is_empty_if_directory_has_not_changed) { - updater.update({}, {}, propertyEditorQmlPath); + updater.update({}, {}, propertyEditorQmlPath, {}); ON_CALL(fileSystemMock, fileStatus(_)).WillByDefault([](SourceId sourceId) { return FileStatus{sourceId, 1, 21}; }); @@ -3515,7 +3528,135 @@ TEST_F(ProjectStorageUpdater, update_property_editor_panes_is_empty_if_directory EXPECT_CALL(projectStorageMock, synchronize(PackageIsEmpty())); - updater.update({}, {}, propertyEditorQmlPath); + updater.update({}, {}, propertyEditorQmlPath, {}); +} + +TEST_F(ProjectStorageUpdater, update_type_annotations) +{ + auto itemSourceId = sourcePathCache.sourceId( + QmlDesigner::SourcePath{itemLibraryPath + "/quick.metainfo"}); + auto buttonSourceId = sourcePathCache.sourceId( + QmlDesigner::SourcePath{itemLibraryPath + "/qtquickcontrols2.metainfo"}); + setFilesChanged({itemLibraryPathSourceId, itemSourceId, buttonSourceId}); + auto qtQuickModuleId = moduleId("QtQuick"); + auto qtQuickControlsModuleId = moduleId("QtQuick.Controls.Basic"); + QmlDesigner::Storage::TypeTraits itemTraits; + itemTraits.canBeContainer = QmlDesigner::FlagIs::True; + + EXPECT_CALL(projectStorageMock, + synchronize(AllOf(Field(&SynchronizationPackage::typeAnnotations, + IsSupersetOf({IsTypeAnnotation(itemSourceId, + itemLibraryPathSourceId, + "Item", + qtQuickModuleId, + StartsWith(itemLibraryPath), + _, + _, + _), + IsTypeAnnotation(buttonSourceId, + itemLibraryPathSourceId, + "Button", + qtQuickControlsModuleId, + StartsWith(itemLibraryPath), + _, + _, + _)})), + Field(&SynchronizationPackage::updatedTypeAnnotationSourceIds, + IsSupersetOf({itemSourceId, buttonSourceId}))))); + + updater.update({}, {}, {}, {itemLibraryPath}); +} + +TEST_F(ProjectStorageUpdater, update_changed_type_annotation) +{ + auto itemSourceId = sourcePathCache.sourceId( + QmlDesigner::SourcePath{itemLibraryPath + "/quick.metainfo"}); + auto buttonSourceId = sourcePathCache.sourceId( + QmlDesigner::SourcePath{itemLibraryPath + "/qtquickcontrols2.metainfo"}); + setFilesDontChanged({itemLibraryPathSourceId}); + setFilesChanged({itemSourceId, buttonSourceId}); + auto qtQuickModuleId = moduleId("QtQuick"); + auto qtQuickControlsModuleId = moduleId("QtQuick.Controls.Basic"); + QmlDesigner::Storage::TypeTraits itemTraits; + itemTraits.canBeContainer = QmlDesigner::FlagIs::True; + + EXPECT_CALL(projectStorageMock, + synchronize(AllOf(Field(&SynchronizationPackage::typeAnnotations, + IsSupersetOf({IsTypeAnnotation(itemSourceId, + itemLibraryPathSourceId, + "Item", + qtQuickModuleId, + StartsWith(itemLibraryPath), + _, + _, + _), + IsTypeAnnotation(buttonSourceId, + itemLibraryPathSourceId, + "Button", + qtQuickControlsModuleId, + StartsWith(itemLibraryPath), + _, + _, + _)})), + Field(&SynchronizationPackage::updatedTypeAnnotationSourceIds, + IsSupersetOf({itemSourceId, buttonSourceId}))))); + + updater.update({}, {}, {}, {itemLibraryPath}); +} + +TEST_F(ProjectStorageUpdater, update_type_annotations_removed_meta_info_file) +{ + ON_CALL(fileSystemMock, fileStatus(_)).WillByDefault([](SourceId sourceId) { + return FileStatus{sourceId, 1, 21}; + }); + ON_CALL(projectStorageMock, fetchFileStatus(_)).WillByDefault([](SourceId sourceId) { + return FileStatus{sourceId, 1, 21}; + }); + auto itemSourceId = sourcePathCache.sourceId( + QmlDesigner::SourcePath{itemLibraryPath + "/quick.metainfo"}); + auto buttonSourceId = sourcePathCache.sourceId( + QmlDesigner::SourcePath{itemLibraryPath + "/qtquickcontrols2.metainfo"}); + ON_CALL(projectStorageMock, typeAnnotationDirectorySourceIds()) + .WillByDefault(Return(QmlDesigner::SmallSourceIds<64>{itemLibraryPathSourceId})); + ON_CALL(projectStorageMock, typeAnnotationSourceIds(itemLibraryPathSourceId)) + .WillByDefault(Return(QmlDesigner::SmallSourceIds<4>{itemSourceId, buttonSourceId})); + setFilesChanged({itemLibraryPathSourceId}); + setFilesDontChanged({itemSourceId, buttonSourceId}); + + EXPECT_CALL(projectStorageMock, + synchronize(AllOf(Field(&SynchronizationPackage::typeAnnotations, IsEmpty()), + Field(&SynchronizationPackage::updatedTypeAnnotationSourceIds, + IsSupersetOf({itemSourceId, buttonSourceId}))))); + + updater.update({}, {}, {}, {itemLibraryPath}); +} + +TEST_F(ProjectStorageUpdater, update_type_annotations_removed_directory) +{ + ON_CALL(fileSystemMock, fileStatus(_)).WillByDefault([](SourceId sourceId) { + return FileStatus{sourceId, 1, 21}; + }); + ON_CALL(projectStorageMock, fetchFileStatus(_)).WillByDefault([](SourceId sourceId) { + return FileStatus{sourceId, 1, 21}; + }); + auto itemSourceId = sourcePathCache.sourceId( + QmlDesigner::SourcePath{itemLibraryPath + "/quick.metainfo"}); + auto buttonSourceId = sourcePathCache.sourceId( + QmlDesigner::SourcePath{itemLibraryPath + "/qtquickcontrols2.metainfo"}); + ON_CALL(projectStorageMock, typeAnnotationDirectorySourceIds()) + .WillByDefault(Return(QmlDesigner::SmallSourceIds<64>{ + itemLibraryPathSourceId, + })); + ON_CALL(projectStorageMock, typeAnnotationSourceIds(itemLibraryPathSourceId)) + .WillByDefault(Return(QmlDesigner::SmallSourceIds<4>{itemSourceId, buttonSourceId})); + setFilesDontExists({itemLibraryPathSourceId, buttonSourceId, itemSourceId}); + + EXPECT_CALL(projectStorageMock, + synchronize(AllOf(Field(&SynchronizationPackage::typeAnnotations, IsEmpty()), + Field(&SynchronizationPackage::updatedTypeAnnotationSourceIds, + IsSupersetOf({buttonSourceId, itemSourceId}))))); + + updater.update({}, {}, {}, {itemLibraryPath}); } } // namespace diff --git a/tests/unit/tests/unittests/projectstorage/typeannotationreader-test.cpp b/tests/unit/tests/unittests/projectstorage/typeannotationreader-test.cpp index ed5c1a0778..b90a4adf1b 100644 --- a/tests/unit/tests/unittests/projectstorage/typeannotationreader-test.cpp +++ b/tests/unit/tests/unittests/projectstorage/typeannotationreader-test.cpp @@ -3,6 +3,7 @@ #include "../utils/googletest.h" +#include <projectstorage-matcher.h> #include <strippedstring-matcher.h> #include <projectstorage/projectstorage.h> @@ -11,24 +12,6 @@ namespace { -template<typename HintsJsonMatcher, typename ItemLibraryJsonMatcher> -auto IsTypeAnnotation(QmlDesigner::SourceId sourceId, - Utils::SmallStringView typeName, - QmlDesigner::ModuleId moduleId, - Utils::SmallStringView iconPath, - QmlDesigner::Storage::TypeTraits traits, - HintsJsonMatcher hintsJsonMatcher, - ItemLibraryJsonMatcher itemLibraryJsonMatcher) -{ - using QmlDesigner::Storage::Synchronization::TypeAnnotation; - return AllOf(Field("sourceId", &TypeAnnotation::sourceId, sourceId), - Field("typeName", &TypeAnnotation::typeName, typeName), - Field("moduleId", &TypeAnnotation::moduleId, moduleId), - Field("iconPath", &TypeAnnotation::iconPath, iconPath), - Field("traits", &TypeAnnotation::traits, traits), - Field("hintsJson", &TypeAnnotation::hintsJson, hintsJsonMatcher), - Field("itemLibraryJson", &TypeAnnotation::itemLibraryJson, itemLibraryJsonMatcher)); -} class TypeAnnotationReader : public testing::Test { @@ -56,6 +39,7 @@ protected: QmlDesigner::ProjectStorage<Sqlite::Database> &storage = *static_projectStorage; QmlDesigner::Storage::TypeAnnotationReader reader{storage}; QmlDesigner::SourceId sourceId = QmlDesigner::SourceId::create(33); + QmlDesigner::SourceId directorySourceId = QmlDesigner::SourceId::create(77); }; TEST_F(TypeAnnotationReader, parse_type) @@ -73,10 +57,11 @@ TEST_F(TypeAnnotationReader, parse_type) })xy"}; QmlDesigner::Storage::TypeTraits traits; - auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId); + auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); ASSERT_THAT(annotations, UnorderedElementsAre(IsTypeAnnotation(sourceId, + directorySourceId, "Frame", moduleId("QtQuick.Controls"), "/path/images/frame-icon16.png", @@ -84,6 +69,7 @@ TEST_F(TypeAnnotationReader, parse_type) IsEmpty(), IsEmpty()), IsTypeAnnotation(sourceId, + directorySourceId, "Item", moduleId("QtQuick"), "/path/images/item-icon16.png", @@ -109,10 +95,11 @@ TEST_F(TypeAnnotationReader, parse_true_canBeContainer) QmlDesigner::Storage::TypeTraits traits; traits.canBeContainer = FlagIs::True; - auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId); + auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); ASSERT_THAT(annotations, ElementsAre(IsTypeAnnotation(sourceId, + directorySourceId, "Frame", moduleId("QtQuick.Controls"), "/path/images/frame-icon16.png", @@ -138,10 +125,11 @@ TEST_F(TypeAnnotationReader, parse_true_forceClip) QmlDesigner::Storage::TypeTraits traits; traits.forceClip = FlagIs::True; - auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId); + auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); ASSERT_THAT(annotations, ElementsAre(IsTypeAnnotation(sourceId, + directorySourceId, "Frame", moduleId("QtQuick.Controls"), "/path/images/frame-icon16.png", @@ -167,10 +155,11 @@ TEST_F(TypeAnnotationReader, parse_true_doesLayoutChildren) QmlDesigner::Storage::TypeTraits traits; traits.doesLayoutChildren = FlagIs::True; - auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId); + auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); ASSERT_THAT(annotations, ElementsAre(IsTypeAnnotation(sourceId, + directorySourceId, "Frame", moduleId("QtQuick.Controls"), "/path/images/frame-icon16.png", @@ -196,10 +185,11 @@ TEST_F(TypeAnnotationReader, parse_true_canBeDroppedInFormEditor) QmlDesigner::Storage::TypeTraits traits; traits.canBeDroppedInFormEditor = FlagIs::True; - auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId); + auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); ASSERT_THAT(annotations, ElementsAre(IsTypeAnnotation(sourceId, + directorySourceId, "Frame", moduleId("QtQuick.Controls"), "/path/images/frame-icon16.png", @@ -225,10 +215,11 @@ TEST_F(TypeAnnotationReader, parse_true_canBeDroppedInNavigator) QmlDesigner::Storage::TypeTraits traits; traits.canBeDroppedInNavigator = FlagIs::True; - auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId); + auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); ASSERT_THAT(annotations, ElementsAre(IsTypeAnnotation(sourceId, + directorySourceId, "Frame", moduleId("QtQuick.Controls"), "/path/images/frame-icon16.png", @@ -254,10 +245,11 @@ TEST_F(TypeAnnotationReader, parse_true_canBeDroppedInView3D) QmlDesigner::Storage::TypeTraits traits; traits.canBeDroppedInView3D = FlagIs::True; - auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId); + auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); ASSERT_THAT(annotations, ElementsAre(IsTypeAnnotation(sourceId, + directorySourceId, "Frame", moduleId("QtQuick.Controls"), "/path/images/frame-icon16.png", @@ -283,10 +275,11 @@ TEST_F(TypeAnnotationReader, parse_true_isMovable) QmlDesigner::Storage::TypeTraits traits; traits.isMovable = FlagIs::True; - auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId); + auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); ASSERT_THAT(annotations, ElementsAre(IsTypeAnnotation(sourceId, + directorySourceId, "Frame", moduleId("QtQuick.Controls"), "/path/images/frame-icon16.png", @@ -312,10 +305,11 @@ TEST_F(TypeAnnotationReader, parse_true_isResizable) QmlDesigner::Storage::TypeTraits traits; traits.isResizable = FlagIs::True; - auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId); + auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); ASSERT_THAT(annotations, ElementsAre(IsTypeAnnotation(sourceId, + directorySourceId, "Frame", moduleId("QtQuick.Controls"), "/path/images/frame-icon16.png", @@ -341,10 +335,11 @@ TEST_F(TypeAnnotationReader, parse_true_hasFormEditorItem) QmlDesigner::Storage::TypeTraits traits; traits.hasFormEditorItem = FlagIs::True; - auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId); + auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); ASSERT_THAT(annotations, ElementsAre(IsTypeAnnotation(sourceId, + directorySourceId, "Frame", moduleId("QtQuick.Controls"), "/path/images/frame-icon16.png", @@ -370,10 +365,11 @@ TEST_F(TypeAnnotationReader, parse_true_isStackedContainer) QmlDesigner::Storage::TypeTraits traits; traits.isStackedContainer = FlagIs::True; - auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId); + auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); ASSERT_THAT(annotations, ElementsAre(IsTypeAnnotation(sourceId, + directorySourceId, "Frame", moduleId("QtQuick.Controls"), "/path/images/frame-icon16.png", @@ -399,10 +395,11 @@ TEST_F(TypeAnnotationReader, parse_true_takesOverRenderingOfChildren) QmlDesigner::Storage::TypeTraits traits; traits.takesOverRenderingOfChildren = FlagIs::True; - auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId); + auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); ASSERT_THAT(annotations, ElementsAre(IsTypeAnnotation(sourceId, + directorySourceId, "Frame", moduleId("QtQuick.Controls"), "/path/images/frame-icon16.png", @@ -428,10 +425,11 @@ TEST_F(TypeAnnotationReader, parse_true_visibleInNavigator) QmlDesigner::Storage::TypeTraits traits; traits.visibleInNavigator = FlagIs::True; - auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId); + auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); ASSERT_THAT(annotations, ElementsAre(IsTypeAnnotation(sourceId, + directorySourceId, "Frame", moduleId("QtQuick.Controls"), "/path/images/frame-icon16.png", @@ -457,10 +455,11 @@ TEST_F(TypeAnnotationReader, parse_true_visibleInLibrary) QmlDesigner::Storage::TypeTraits traits; traits.visibleInLibrary = FlagIs::True; - auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId); + auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); ASSERT_THAT(annotations, ElementsAre(IsTypeAnnotation(sourceId, + directorySourceId, "Frame", moduleId("QtQuick.Controls"), "/path/images/frame-icon16.png", @@ -485,10 +484,11 @@ TEST_F(TypeAnnotationReader, parse_false) })xy"}; QmlDesigner::Storage::TypeTraits traits; - auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId); + auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); ASSERT_THAT(annotations, ElementsAre(IsTypeAnnotation(sourceId, + directorySourceId, "Frame", moduleId("QtQuick.Controls"), "/path/images/frame-icon16.png", @@ -526,10 +526,11 @@ TEST_F(TypeAnnotationReader, parse_complex_expression) QmlDesigner::Storage::TypeTraits itemTraits; itemTraits.canBeContainer = QmlDesigner::FlagIs::True; - auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId); + auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); ASSERT_THAT(annotations, UnorderedElementsAre(IsTypeAnnotation(sourceId, + directorySourceId, "Frame", moduleId("QtQuick.Controls"), "/path/images/frame-icon16.png", @@ -538,6 +539,7 @@ TEST_F(TypeAnnotationReader, parse_complex_expression) "visibleNonDefaultProperties":"layer.effect"})xy"), IsEmpty()), IsTypeAnnotation(sourceId, + directorySourceId, "Item", moduleId("QtQuick"), "/path/images/item-icon16.png", @@ -573,10 +575,11 @@ TEST_F(TypeAnnotationReader, parse_item_library_entry) })xy"}; QmlDesigner::Storage::TypeTraits traits; - auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId); + auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); ASSERT_THAT(annotations, ElementsAre(IsTypeAnnotation(sourceId, + directorySourceId, "Frame", moduleId("QtQuick.Controls"), "/path/images/frame-icon16.png", @@ -584,12 +587,12 @@ TEST_F(TypeAnnotationReader, parse_item_library_entry) IsEmpty(), StrippedStringEq(R"xy([ {"category":"Qt Quick - Controls 2", - "iconPath":"images/frame-icon.png", + "iconPath":"/path/images/frame-icon.png", "import":"QtQuick.Controls", "name":"Frame", "toolTip":"qsTr(\"An untitled container for a group of controls.\")"}, {"category":"Qt Quick - Controls 2", - "iconPath":"images/frame-icon.png", + "iconPath":"/path/images/frame-icon.png", "import":"QtQuick.Controls", "name":"Large Frame", "toolTip":"qsTr(\"An large container for a group of controls.\")"}] @@ -629,10 +632,11 @@ TEST_F(TypeAnnotationReader, parse_item_library_entry_with_properties) })xy"}; QmlDesigner::Storage::TypeTraits traits; - auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId); + auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); ASSERT_THAT(annotations, ElementsAre(IsTypeAnnotation(sourceId, + directorySourceId, "Frame", moduleId("QtQuick.Controls"), "/path/images/frame-icon16.png", @@ -640,13 +644,13 @@ TEST_F(TypeAnnotationReader, parse_item_library_entry_with_properties) IsEmpty(), StrippedStringEq(R"xy([ {"category":"Qt Quick - Controls 2", - "iconPath":"images/frame-icon.png", + "iconPath":"/path/images/frame-icon.png", "import":"QtQuick.Controls", "name":"Frame", "properties":[["width","int",200.0],["height","int",100.0]], "toolTip":"qsTr(\"An untitled container for a group of controls.\")"}, {"category":"Qt Quick - Controls 2", - "iconPath":"images/frame-icon.png", + "iconPath":"/path/images/frame-icon.png", "import":"QtQuick.Controls", "name":"Large Frame", "properties":[["width","int",2000.0],["height","int",1000.0]], @@ -679,13 +683,14 @@ TEST_F(TypeAnnotationReader, parse_item_library_entry_template_path) })xy"}; QmlDesigner::Storage::TypeTraits traits; - auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId); + auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); ASSERT_THAT(annotations, ElementsAre(IsTypeAnnotation(sourceId, + directorySourceId, "Frame", moduleId("QtQuick.Controls"), - {}, + Utils::SmallStringView{}, traits, IsEmpty(), StrippedStringEq(R"xy([ @@ -693,9 +698,10 @@ TEST_F(TypeAnnotationReader, parse_item_library_entry_template_path) "templatePath":"/path/templates/frame.qml"}] )xy")), IsTypeAnnotation(sourceId, + directorySourceId, "Item", moduleId("QtQuick"), - {}, + Utils::SmallStringView{}, traits, IsEmpty(), StrippedStringEq(R"xy([ @@ -730,13 +736,14 @@ TEST_F(TypeAnnotationReader, parse_item_library_entry_extra_file_paths) })xy"}; QmlDesigner::Storage::TypeTraits traits; - auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId); + auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId); ASSERT_THAT(annotations, ElementsAre(IsTypeAnnotation(sourceId, + directorySourceId, "Frame", moduleId("QtQuick.Controls"), - {}, + Utils::SmallStringView{}, traits, IsEmpty(), StrippedStringEq(R"xy([ @@ -744,9 +751,10 @@ TEST_F(TypeAnnotationReader, parse_item_library_entry_extra_file_paths) "name":"Frame"}] )xy")), IsTypeAnnotation(sourceId, + directorySourceId, "Item", moduleId("QtQuick"), - {}, + Utils::SmallStringView{}, traits, IsEmpty(), StrippedStringEq(R"xy([ diff --git a/tests/unit/tests/unittests/utils/smallstring-test.cpp b/tests/unit/tests/unittests/utils/smallstring-test.cpp index 3594c838c9..71090f8760 100644 --- a/tests/unit/tests/unittests/utils/smallstring-test.cpp +++ b/tests/unit/tests/unittests/utils/smallstring-test.cpp @@ -1326,6 +1326,19 @@ TEST(SmallString, starts_with_string_view) ASSERT_FALSE(text.startsWith('@')); } +TEST(SmallString, starts_with_qstringview) +{ + using namespace Qt::StringLiterals; + SmallString text("$column"); + + ASSERT_FALSE(text.startsWith(u"$columnxxx"_s)); + ASSERT_TRUE(text.startsWith(u"$column"_s)); + ASSERT_TRUE(text.startsWith(u"$col"_s)); + ASSERT_FALSE(text.startsWith(u"col"_s)); + ASSERT_TRUE(text.startsWith(u"$"_s)); + ASSERT_FALSE(text.startsWith(u"@"_s)); +} + TEST(SmallString, ends_with) { SmallString text("/my/path"); |