Fix the result width check in the ellipsization unit test
When processing mnemonics, the resulting string should still contain them and they need to be stripped before measuring its width, but the code didn't do it. This didn't prevent the tests from passing, but only due to another bug in ellipsization code itself, which lost the mnemonics completely. As this bug is about to be fixed, the test needs to take mnemonics into account properly now.
This commit is contained in:
@@ -108,6 +108,16 @@ void EllipsizationTestCase::NormalCase()
|
||||
flagsToTest[f]
|
||||
);
|
||||
|
||||
// Note that we must measure the width of the text that
|
||||
// will be rendered, and when mnemonics are used, this
|
||||
// means we have to remove them first.
|
||||
const wxString
|
||||
displayed = flagsToTest[f] & wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS
|
||||
? wxControl::RemoveMnemonics(ret)
|
||||
: ret;
|
||||
const int
|
||||
width = dc.GetMultiLineTextExtent(displayed).GetWidth();
|
||||
|
||||
WX_ASSERT_MESSAGE
|
||||
(
|
||||
(
|
||||
@@ -115,10 +125,10 @@ void EllipsizationTestCase::NormalCase()
|
||||
s, f, m,
|
||||
str,
|
||||
ret,
|
||||
dc.GetMultiLineTextExtent(ret).GetWidth(),
|
||||
width,
|
||||
widthsToTest[w]
|
||||
),
|
||||
dc.GetMultiLineTextExtent(ret).GetWidth() <= widthsToTest[w]
|
||||
width <= widthsToTest[w]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user