Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
a484bb24
Commit
a484bb24
authored
May 20, 2010
by
Thomas Hartmann
Browse files
QmlDesigner.tests: an integration test for the metaInfo
parent
9ed5dac7
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/auto/qml/qmldesigner/coretests/testcore.cpp
View file @
a484bb24
...
...
@@ -43,6 +43,7 @@
#include
<rewritingexception.h>
#include
<nodeinstanceview.h>
#include
<nodeinstance.h>
#include
<subcomponentmanager.h>
#include
<QDebug>
#include
"../testview.h"
...
...
@@ -3244,6 +3245,38 @@ void TestCore::testCopyModelRewriter2()
QCOMPARE
(
textEdit2
.
toPlainText
(),
qmlString1
);
}
void
TestCore
::
testSubComponentManager
()
{
QString
fileName
=
QString
(
QTCREATORDIR
)
+
"/tests/auto/qml/qmldesigner/data/fx/usingmybutton.qml"
;
QFile
file
(
fileName
);
QVERIFY
(
file
.
open
(
QIODevice
::
ReadOnly
|
QIODevice
::
Text
));
QPlainTextEdit
textEdit
;
textEdit
.
setPlainText
(
file
.
readAll
());
NotIndentingTextEditModifier
modifier
(
&
textEdit
);
QScopedPointer
<
Model
>
model
(
Model
::
create
(
"Qt/Item"
));
model
->
setFileUrl
(
QUrl
::
fromLocalFile
(
fileName
));
QScopedPointer
<
SubComponentManager
>
subComponentManager
(
new
SubComponentManager
(
model
->
metaInfo
(),
0
));
subComponentManager
->
update
(
QUrl
::
fromLocalFile
(
fileName
),
modifier
.
text
().
toUtf8
());
QScopedPointer
<
TestRewriterView
>
testRewriterView
(
new
TestRewriterView
());
testRewriterView
->
setTextModifier
(
&
modifier
);
model
->
attachView
(
testRewriterView
.
data
());
QVERIFY
(
testRewriterView
->
errors
().
isEmpty
());
QVERIFY
(
testRewriterView
->
rootModelNode
().
isValid
());
QVERIFY
(
model
->
metaInfo
().
nodeMetaInfo
(
"Qt/Rectangle"
).
properties
(
true
).
keys
().
contains
(
"border.width"
));
QVERIFY
(
model
->
metaInfo
().
hasNodeMetaInfo
(
"Qt/Pen"
));
NodeMetaInfo
myButtonMetaInfo
=
model
->
metaInfo
().
nodeMetaInfo
(
"MyButton"
);
QVERIFY
(
myButtonMetaInfo
.
isValid
());
QVERIFY
(
myButtonMetaInfo
.
properties
(
true
).
keys
().
contains
(
"border.width"
));
QVERIFY
(
myButtonMetaInfo
.
property
(
"border.width"
,
true
).
isValid
());
}
void
TestCore
::
loadQml
()
{
...
...
@@ -3576,11 +3609,14 @@ void TestCore::testMetaInfoDotProperties()
QVERIFY
(
!
rectNode
.
metaInfo
().
properties
().
keys
().
contains
(
"pos.x"
));
QVERIFY
(
rectNode
.
metaInfo
().
properties
(
true
).
keys
().
contains
(
"pos.y"
));
QVERIFY
(
!
rectNode
.
metaInfo
().
properties
().
keys
().
contains
(
"pos.y"
));
QVERIFY
(
!
rectNode
.
metaInfo
().
properties
().
keys
().
contains
(
"anchors.topMargin"
));
QVERIFY
(
rectNode
.
metaInfo
().
properties
(
true
).
keys
().
contains
(
"border.width"
));
QVERIFY
(
rectNode
.
metaInfo
().
hasProperty
(
"border"
));
QVERIFY
(
!
rectNode
.
metaInfo
().
property
(
"border"
).
isValueType
());
QVERIFY
(
rectNode
.
metaInfo
().
hasProperty
(
"border.width"
,
true
));
QVERIFY
(
rectNode
.
metaInfo
().
property
(
"border.width"
,
true
).
isValid
());
QVERIFY
(
rectNode
.
metaInfo
().
property
(
"border.width"
,
true
).
isValid
());
QVERIFY
(
rectNode
.
metaInfo
().
property
(
"anchors.topMargin"
,
true
).
isValid
());
}
void
TestCore
::
testMetaInfoListProperties
()
...
...
tests/auto/qml/qmldesigner/coretests/testcore.h
View file @
a484bb24
...
...
@@ -163,6 +163,7 @@ private slots:
void
testRewriterTransactionRewriter
();
void
testCopyModelRewriter1
();
void
testCopyModelRewriter2
();
void
testSubComponentManager
();
//
// regression tests
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment