1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-01-27 09:08:25 +00:00

add special case for X11 tests

This commit is contained in:
Caio Freitas de Oliveira 2022-10-12 19:27:55 -03:00 committed by Brenden Matthews
parent 48b7271c0d
commit 8a64e4134e
2 changed files with 8 additions and 3 deletions

View File

@ -81,7 +81,9 @@ void gradient_factory::setup_masks() {
void gradient_factory::setup_colour_depth() { void gradient_factory::setup_colour_depth() {
#ifdef BUILD_X11 #ifdef BUILD_X11
if (out_to_x.get(*state)) { if (state == nullptr) { // testing purposes
colour_depth = 24;
} else if (out_to_x.get(*state)) {
colour_depth = DisplayPlanes(display, screen); colour_depth = DisplayPlanes(display, screen);
} else } else
#endif /* BUILD_X11 */ #endif /* BUILD_X11 */

View File

@ -32,7 +32,8 @@
#include <gradient.h> #include <gradient.h>
const int width = 4; const int width = 4;
#ifdef BUILD_GUI // 24-bit color depth #ifdef BUILD_X11 // 24-bit color depth
#include <x11.h>
const long colour = 0x996633; // brown const long colour = 0x996633; // brown
const long expected_hue = 256; const long expected_hue = 256;
const long expected_value = 0x99; // max(0x99, 0x66, 0x33) const long expected_value = 0x99; // max(0x99, 0x66, 0x33)
@ -57,7 +58,9 @@ const long expected_blue = 0x06;
const long full_scale = conky::gradient_factory::SCALE360; const long full_scale = conky::gradient_factory::SCALE360;
TEST_CASE("gradient_factory::convert_from_rgb returns correct value") { TEST_CASE("gradient_factory::convert_from_rgb returns correct value") {
#ifdef BUILD_X11
state = nullptr; state = nullptr;
#endif
SECTION("rgb_gradient_factory") { SECTION("rgb_gradient_factory") {
auto factory = new conky::rgb_gradient_factory(width, colour, colour); auto factory = new conky::rgb_gradient_factory(width, colour, colour);
long result[3]; long result[3];
@ -135,7 +138,7 @@ TEST_CASE(
* Due to lack of precision, the HSV and HCL functions are not reversible * Due to lack of precision, the HSV and HCL functions are not reversible
* if color depth is less than 24-bit * if color depth is less than 24-bit
*/ */
#ifdef BUILD_GUI #ifdef BUILD_X11
SECTION("hsv_gradient_factory") { SECTION("hsv_gradient_factory") {
long tmp[3]; long tmp[3];
auto factory = new conky::hsv_gradient_factory(width, colour, colour); auto factory = new conky::hsv_gradient_factory(width, colour, colour);