Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
31c22183
Commit
31c22183
authored
7 years ago
by
Pospelov, Gennady
Browse files
Options
Downloads
Patches
Plain Diff
Bug in item controller when widget is always hidden
parent
593e427f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/coregui/Views/CommonWidgets/SessionItemController.cpp
+3
-1
3 additions, 1 deletion
GUI/coregui/Views/CommonWidgets/SessionItemController.cpp
Tests/UnitTests/GUI/TestSessionItemController.h
+34
-0
34 additions, 0 deletions
Tests/UnitTests/GUI/TestSessionItemController.h
with
37 additions
and
1 deletion
GUI/coregui/Views/CommonWidgets/SessionItemController.cpp
+
3
−
1
View file @
31c22183
...
@@ -81,7 +81,9 @@ void SessionItemController::unsubscribe()
...
@@ -81,7 +81,9 @@ void SessionItemController::unsubscribe()
if
(
!
m_item
)
if
(
!
m_item
)
return
;
return
;
unsubscribeParent
();
if
(
m_parent_subscribed
)
unsubscribeParent
();
m_item
->
mapper
()
->
unsubscribe
(
parent
());
m_item
->
mapper
()
->
unsubscribe
(
parent
());
}
}
...
...
This diff is collapsed.
Click to expand it.
Tests/UnitTests/GUI/TestSessionItemController.h
+
34
−
0
View file @
31c22183
...
@@ -79,6 +79,7 @@ private slots:
...
@@ -79,6 +79,7 @@ private slots:
void
test_onItemDestroyWidgetVisible
();
void
test_onItemDestroyWidgetVisible
();
void
test_onItemDestroyWidgetHidden
();
void
test_onItemDestroyWidgetHidden
();
void
test_onTwoItems
();
void
test_onTwoItems
();
void
test_onTwoItemsWhenHidden
();
void
test_deleteWidget
();
void
test_deleteWidget
();
};
};
...
@@ -273,6 +274,39 @@ inline void TestSessionItemController::test_onTwoItems()
...
@@ -273,6 +274,39 @@ inline void TestSessionItemController::test_onTwoItems()
QCOMPARE
(
listener
.
m_onPropertyChangeCount
,
2
);
QCOMPARE
(
listener
.
m_onPropertyChangeCount
,
2
);
}
}
//! Settings two items one after another, when widget stays hidden
inline
void
TestSessionItemController
::
test_onTwoItemsWhenHidden
()
{
TestListener
listener
;
TestObject
object
(
&
listener
);
SessionModel
model
(
"TestModel"
);
SessionItem
*
item1
=
model
.
insertNewItem
(
Constants
::
BasicAxisType
);
SessionItem
*
item2
=
model
.
insertNewItem
(
Constants
::
BasicAxisType
);
object
.
setVisible
(
false
);
object
.
setItem
(
item1
);
QCOMPARE
(
object
.
currentItem
(),
item1
);
item1
->
setItemValue
(
BasicAxisItem
::
P_MAX
,
4.0
);
QCOMPARE
(
listener
.
m_onItemDestroyedCount
,
0
);
QCOMPARE
(
listener
.
m_onPropertyChangeCount
,
0
);
// changing the item
object
.
setItem
(
item2
);
QCOMPARE
(
object
.
currentItem
(),
item2
);
// changing the value of previous item, widget shouldn't react
item1
->
setItemValue
(
BasicAxisItem
::
P_MAX
,
5.0
);
QCOMPARE
(
listener
.
m_onItemDestroyedCount
,
0
);
QCOMPARE
(
listener
.
m_onPropertyChangeCount
,
0
);
// changing the value of new item, widget shouldn't react
item2
->
setItemValue
(
BasicAxisItem
::
P_MAX
,
6.0
);
QCOMPARE
(
listener
.
m_onPropertyChangeCount
,
0
);
}
//! Deleting the widget when item still alive.
//! Deleting the widget when item still alive.
inline
void
TestSessionItemController
::
test_deleteWidget
()
inline
void
TestSessionItemController
::
test_deleteWidget
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment