Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
SDK
Umbrello
Commits
6de2d930
Commit
6de2d930
authored
Dec 11, 2014
by
Ralf Habacker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add dynamic cast test to be sure we can trust getting zero pointer for invalid casts.
CCBUG:341709
parent
c359c267
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
unittests/TEST_basictypes.cpp
unittests/TEST_basictypes.cpp
+21
-0
No files found.
unittests/TEST_basictypes.cpp
View file @
6de2d930
...
...
@@ -26,6 +26,7 @@ class TEST_basictypes : public QObject
{
Q_OBJECT
private
slots
:
void
test_dynamic_cast
();
void
test_ModelType_toString
();
void
test_ModelType_fromString
();
void
test_ModelType_forLoop
();
...
...
@@ -48,6 +49,26 @@ private slots:
//-----------------------------------------------------------------------------
class
A
{
public:
virtual
~
A
()
{
}
};
class
B
:
public
A
{
};
void
TEST_basictypes
::
test_dynamic_cast
()
{
A
*
a1
=
new
A
;
B
*
b1
=
dynamic_cast
<
B
*>
(
a1
);
QVERIFY
(
!
b1
);
A
*
a2
=
new
B
;
B
*
b2
=
dynamic_cast
<
B
*>
(
a2
);
QVERIFY
(
b2
);
}
void
TEST_basictypes
::
test_ModelType_toString
()
{
Uml
::
ModelType
::
Enum
model0
=
Uml
::
ModelType
::
Logical
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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