@@ -364,8 +364,6 @@ ColorTypes.comp2(c::RGBA32) = alpha(c)
364364 @test_throws MethodError sum (abs2, RGB (0.1 ,0.2 ,0.3 ))
365365 @test norm (RGB (0.1 ,0.2 ,0.3 )) ≈ sqrt (0.14 )/ sqrt (3 )
366366
367- @test_throws MethodError RGBX (0 , 0 , 1 ) + XRGB (1 , 0 , 0 )
368-
369367 acu = RGB{N0f8}[cu]
370368 acf = RGB{Float32}[cf]
371369 @test typeof (acu+ acf) == Vector{RGB{Float32}}
@@ -529,7 +527,14 @@ ColorTypes.comp2(c::RGBA32) = alpha(c)
529527 end
530528
531529 @testset " Mixed-type arithmetic" begin
530+ # issue 155
531+ @test @inferred (Gray (0.2f0 ) + Gray24 (0.2 )) === Gray {Float32} (0.2 + 0.2 N0f8)
532+ @test @inferred (RGBX (0 , 0 , 1 ) + XRGB (1 , 0 , 0 )) === XRGB {N0f8} (1 , 0 , 1 )
533+ @test @inferred (BGR (0 , 0 , 1 ) + RGB24 (1 , 0 , 0 )) === RGB {N0f8} (1 , 0 , 1 )
534+ @test_throws Exception HSV (100 , 0.2 , 0.4 ) + Gray (0.2 )
535+
532536 @test AGray32 (0.2 , 0.4 ) + Gray24 (0.2 ) === AGray32 (0.4 , 0.4 N0f8+ 1 N0f8)
537+ @test AGray32 (0.2 , 0.4 ) + Gray (0.2f0 ) === AGray {Float32} (0.2 + 0.2 N0f8, 0.4 N0f8+ 1 )
533538 @test RGB (1 , 0 , 0 ) + Gray (0.2f0 ) === RGB {Float32} (1.2 , 0.2 , 0.2 )
534539 @test RGB (1 , 0 , 0 ) - Gray (0.2f0 ) === RGB {Float32} (0.8 , - 0.2 , - 0.2 )
535540 @test RGB24 (1 , 0 , 0 ) + Gray (0.2f0 ) === RGB {Float32} (1.2 , 0.2 , 0.2 )
@@ -541,6 +546,7 @@ ColorTypes.comp2(c::RGBA32) = alpha(c)
541546 @test RGB24 (0.4 , 0.6 , 0.5 ) - AGray32 (0.4 , 0.2 ) === ARGB32 (0 , 0.2 , 0.1 , 0.8 )
542547 @test ARGB32 (0.4 , 0 , 0.2 , 0.5 ) + Gray24 (0.4 ) === ARGB32 (0.8 , 0.4 , 0.6 , 0.5 N0f8+ 1 N0f8)
543548 @test ARGB32 (0.4 , 0 , 0.2 , 0.5 ) + AGray32 (0.4 , 0.2 ) === ARGB32 (0.8 , 0.4 , 0.6 , 0.5 N0f8+ 0.2 N0f8)
549+ @test ARGB32 (0.4 , 0 , 0.2 , 0.5 ) + RGB (0.4f0 , 0 , 0 ) === ARGB {Float32} (0.4 N0f8+ 0.4 , 0 , 0.2 N0f8, 0.5 N0f8+ 1 )
544550
545551 g, rgb = Gray {Float32} (0.2 ), RGB {Float64} (0.1 , 0.2 , 0.3 )
546552 ag, argb = AGray {Float64} (0.2 , 0.8 ), ARGB {Float32} (0.1 , 0.2 , 0.3 , 0.4 )
0 commit comments