Fixes #2358 - BREAKING CHANGE: Pos.Combine is incorrect for scenarios involving PosAbsolute#2379
Fixes #2358 - BREAKING CHANGE: Pos.Combine is incorrect for scenarios involving PosAbsolute#2379tig wants to merge 16 commits intogui-cs:developfrom
Pos.Combine is incorrect for scenarios involving PosAbsolute#2379Conversation
… not reproduce (gui-cs#2332)" This reverts commit c85ff95.
|
@BDisp - can you please do a CR of this? |
|
@tig none of theses labels are redrawing on the var label = new Label ("I'm a Window") {
X = Pos.Center (),
Y = Pos.Center () - 3,
};
var label2 = new Label ("I'm a Toplevel") {
X = Pos.Center (),
Y = Pos.Center () - 3,
};
var label3 = new Label ("I'm a FrameView") {
X = Pos.Center (),
Y = Pos.Center () - 3,
}; |
BDisp
left a comment
There was a problem hiding this comment.
I wrote some considerations about this. I hope you don´t mind.
| [Fact, AutoInitShutdown] | ||
| public void Frame_And_Labels_Does_Not_Overspill_ScrollView () |
There was a problem hiding this comment.
These are also good unit to test with layout. I hope you reconsidered to not remove them.
There was a problem hiding this comment.
They were moved to LayoutTest.cs (or at least I meant to move them... Or I deleted them by accident). I'll re-look.
| @@ -1109,8 +1110,15 @@ public void BringSubviewForward (View subview) | |||
| /// </remarks> | |||
| public void Clear () | |||
| [Fact, AutoInitShutdown] | ||
| public void BorderStyle_And_DrawMarginFrame_Gets_Sets () |
There was a problem hiding this comment.
I hope you also maintain this unit test. I think you have some errors because of the View.Clear method.
This is caused by bugs in those scenarios that I didn't notice: var label = new Label ("I'm a Window") {
X = Pos.Center (),
Y = Pos.Center () - 3,
};
This works better: var label = new Label ("I'm a Window") {
X = Pos.Center (),
Y = Pos.Top (button) - 1
};This regex search finds all instances of potential bugs that do this |
|
I just pushed several fixes to this PR that fix the issues you noted. However, one fix that SHOULD have worked has caused another problem in the 3 "Borders on XXX" scenarios: The button isn't painting right. Since this doesn't happen in "Borders Comparsion" I'm wondering if this is another bug in the Scenario. Debugging now... |
I already noted that. Try to comment in the View on the GetMaxNeedDisplay method these two lines: + //rect.Width += Math.Max (oldFrame.X - newFrame.X, 0);
+ //rect.Height += Math.Max (oldFrame.Y - newFrame.Y, 0);
@tig I prefer to use the |
The bug is here, I think:
I'm out of time for tonight. I you get a chance can you file a new issue for that? |
Well, that didn't work, did it? Center WASN'T working right ;-). I'm out of time tonight so I'm going to leave it as-is for now. |
|
Now that I think about it more: Why isn't |
If the Driver.Clip is equal to the current view bounds it's ok, otherwise is better maintain as is. I'll work on this tomorrow. |
|
I now no longer want to fix this in v1. This bug has persisted for years and I'm the first to notice it. I am getting worn out trying to merge v1 changes into v2. I spent 3 hours yesterday and ended up giving up because I had made such a mess. |
|
Closing as a dupe of #2385 |









Pos.Combineis incorrect for scenarios involvingPosAbsolute#2358SetRelativeLayoutless fragileSetRelativeLayoutand the related methods were refactoredCore/LayoutTests.csPos.Combineis incorrect for scenarios involvingPosAbsolute#2358Borderwhere it was not checking for negative row/col valuesThis is a breaking change (it changes the previous behavior of SetRelativeLayout) and breaks any code that was using
PosCombinebut not realizing the results were invalid. For example, all of theBorderrelated Scenarios.We should take this breaking change because it fixes a real problem in how the API is supposed to work.
Pull Request checklist:
CTRL-K-Dto automatically reformat your files before committing.dotnet testbefore commit///style comments)