extract(2) should reduce the map to exactly the original first and last colors.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(inout) | :: | id | |||
| integer, | intent(inout) | :: | nfail |
subroutine test_068(id, nfail) use forcolormap, only: Colormap, wp integer, intent(inout) :: id, nfail character(len=*), parameter :: name = "extract(2) keeps original endpoints" logical :: ok type(Colormap) :: cm integer :: r0, g0, b0, r1, g1, b1 integer :: rr0, gg0, bb0, rr1, gg1, bb1 integer :: n0 call cm%set("viridis", 0.0_wp, 1.0_wp) n0 = cm%get_levels() call cm%get_RGB(0, r0, g0, b0) call cm%get_RGB(n0-1, r1, g1, b1) call cm%extract(2) call cm%get_RGB(0, rr0, gg0, bb0) call cm%get_RGB(1, rr1, gg1, bb1) ok = (cm%get_levels() == 2) .and. & (rr0 == r0) .and. (gg0 == g0) .and. (bb0 == b0) .and. & (rr1 == r1) .and. (gg1 == g1) .and. (bb1 == b1) call report_test(name, ok, id, nfail) end subroutine test_068