DYN-4361: enabled clipboard copy for preview bubbles and watch nodes#15844
DYN-4361: enabled clipboard copy for preview bubbles and watch nodes#15844zeusongit merged 7 commits intoDynamoDS:masterfrom
Conversation
- enabled clipboard copy on Ctrl+C for info bubbles and watch nodes - added test coverage
There was a problem hiding this comment.
See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-4361
|
So far testing locally with copying various data and arrow key navigation, this looks pretty good to me. |
| private void treeviewItem_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) | ||
| { | ||
| if (prevWatchViewModel != null) | ||
| if (prevWatchViewModel != null || Models.DynamoModel.IsTestMode) |
There was a problem hiding this comment.
Is prevWatchViewModel value null when in TestMode?
There was a problem hiding this comment.
no it shouldn't be null.
There was a problem hiding this comment.
then I am confused, why add the IsTestMode condition?
There was a problem hiding this comment.
It was null, yes. At least when reusing the design pattern of the existing watchnode/info-bubble tests. I didn't feel I should go out of my way to look into creating the view model, as this solution worked and I have used it (bypassing checks based on Dynamo.IsTestMode) in the past in similar circumstances.
There was a problem hiding this comment.
All tests of this test suite passed locally as well.
There was a problem hiding this comment.
@dnenov Thank you for the new changes, looks clean and better.
Is there any unit test present for this functionality? Which tests are being affected, causing the need for IsTestMode check.
There was a problem hiding this comment.
I will remove the IsTestMode , you are right! Apologies.
|
Is this going to be in 3.5? |
Yes |
| this.Loaded += WatchTree_Loaded; | ||
| this.Unloaded += WatchTree_Unloaded; | ||
|
|
||
| _ctrlResetTimer.Tick += _ctrlResetTimer_Tick; |
There was a problem hiding this comment.
We are using this pattern inside the DynamoView (_workspaceResizeTimer.Tick += _resizeTimer_Tick;) without unsubscribing, I assumed this is safe.
There was a problem hiding this comment.
Can we unsubscribe to it? If possible? Probably add a Dispose method?
There was a problem hiding this comment.
Of course. The Watchnode does not have a Dispose, but a similar thing is happening inside the Loaded/Unloaded handlers.
There was a problem hiding this comment.
@zeusongit I removed the timer altogether. Sporadic tests were failing, I don't know if that was due to a leak, but I was able to remove the timer while tinkering. Sadly, I cannot figure out a way to test for the Keyboard.Modifiers combination, as far as I can see it's impossible to set that programmatically. So I don't have a way of Unit testing that functionality. I don't know if we have a different framework for Integration tests that we use to simulate clicks and user interactions, but probably that would be the way to do it.
There was a problem hiding this comment.
Thanks @dnenov, I was iffy with the timer approach myself, so thanks for looking into it. I will ask if this is something AGT tests can cover.
- moved subscribe/unsubscribe from timer events inside the loaded/unloaded parts of the watchnode
|
@dnenov One failed test that looks new, Dynamo.Tests.SerializationTests.InPortDescriptionDeserilizationTest |
- tooltip text change for the color node was causing a test to fail, fixing that although it's not part of the scope of this PR
I fixed the test, although it was not related to this PR. Now a different test is failing, which passes locally Could it be that changes to the master are interfering? This PR should not be affecting these tests. |
- now uses `Keyboard.Modifiers ` to detect Ctrl+C combination, which eliminates the need for a timer altogether - no longer able to do a wpf test, I found it impossible to simulate the hardware keyboard.modifiers necessary for the test to run
|
RemovesScriptTagsFromLoadedHtml has been flaky on CI jobs. |
|
|
||
| var nodeModelNode = this.CurrentDynamoModel.CurrentWorkspace.Nodes.Where(x => x.GUID == new Guid("c848cc3cb24a477f8248e53fc9304cc1")).First(); | ||
| Assert.AreEqual(nodeModelNode.InPorts.First().ToolTip, "List of colors to include in the range"); | ||
| Assert.AreEqual(nodeModelNode.InPorts.First().ToolTip, "List of colors to include in the range (disabled)"); |
There was a problem hiding this comment.
There was a problem hiding this comment.
I don't think this is the expected fix here @dnenov , need to dig why and when was the tooltip changed. Also I think the expected and actual variables are inverted in the test.
There was a problem hiding this comment.
Yes, it looks to me that this tooltip recently changed - I think it's on the Color node, or similar. And it's hard-coded inside the test, so that's the fix of it.
- remove unnecessary code

Purpose
Addresses the following Jira issue - Enable Ctrl + C to copy selected data out of preview bubbles/watch nodes
The solution was not as straightforward as the text nodes to copy from were children of a
TreeViewelement.TreeViewItemmanipulation, which was already working to enable the up/down navigation.Ctrloccurrences.Declarations
Check these if you believe they are true
*.resxfilesRelease Notes
Reviewers
@achintyabhat
@reddyashish
@zeusongit
FYIs
@QilongTang
@johnpierson