Commit d21fd950 authored by Glen Ditchfield's avatar Glen Ditchfield 🐛 Committed by Glen Ditchfield

Fix autotests/testincidenceformatter

At the moment testincidenceformatter passes in the PIM Docker image but
fails in Jenkins because of differences in palette colors for button
backgrounds, foregrounds, and borders.

Testing for specific colors has repeatedly proved to be fragile.  This
patch abstracts them out, and tests that the colors used are whatever the
current palette provides.
parent f5a456ac
Pipeline #44017 passed with stage
in 5 minutes and 44 seconds
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -45,16 +45,16 @@ td {
font-weight: bold !important;
padding: 4px 8px !important;
margin-bottom: 4px !important;
border: 1px solid #474a4c !important;
border: 1px solid btnBdr !important;
border-radius: 3px !important;
background: #eff0f1 !important;
background: btnBg !important;
vertical-align: middle !important;
}
#invitation .button:hover{
border-color: #474a4c !important;
border-color: btnBdr !important;
}
#invitation a.button {
color: #232627 !important;
color: btnFg !important;
}
#invitation .button img{
vertical-align: middle !important;
......
......@@ -41,6 +41,12 @@ Q_CONSTRUCTOR_FUNCTION(initLocale)
using namespace KCalendarCore;
using namespace KCalUtils;
// Button colors.
static QString btnBg;
static QString btnFg;
static QString btnBdr;
static QString btnHl;
void IncidenceFormatterTest::initTestCase()
{
QStandardPaths::setTestModeEnabled(true);
......@@ -48,6 +54,14 @@ void IncidenceFormatterTest::initTestCase()
GrantleeTemplateManager::instance()->setPluginPath(QStringLiteral(TEST_PLUGIN_PATH));
QIcon::setThemeName(QStringLiteral("oxygen"));
QLocale::setDefault(QLocale(QStringLiteral("C")));
QPalette palette;
palette.setCurrentColorGroup(QPalette::Normal);
btnBg = palette.color(QPalette::Button).name();
btnBdr = palette.shadow().color().name();
btnFg = palette.color(QPalette::ButtonText).name();
palette.