Mercurial > hg > octave-nkf
annotate test/fcn-handle-derived-resolution/fcn-handle-derived-resolution.tst @ 20579:131ce8cfaa80
Relax input in functions that convert between colorspaces (bug #45456)
* scripts/image/hsv2rgb.m, scripts/image/ntsc2rgb.m, scripts/image/rgb2hsv.m,
scripts/image/rgb2ntsc.m: remove all input check and leave it up to new
private functions handled by all. This adds support for ND images, drops
check for values in the [0 1] range, allows integer images, and allows
sparse matrices. Also adjust tests and add extra ones.
* scripts/image/private/colorspace_conversion_input_check.m,
scripts/image/private/colorspace_conversion_revert.m: all of this functions
handle input check in the same way. In the same way, they need to prepare
the output in the same way based on what preparation was done during input
check (transforming image into colormap). So we create two new private
functions to avoid repeated code. All code was adapted from hsv2rgb.
author | Carnë Draug <carandraug@octave.org> |
---|---|
date | Sun, 19 Jul 2015 17:41:21 +0100 |
parents | 4197fc428c7d |
children |
rev | line source |
---|---|
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
18482
diff
changeset
|
1 ## Copyright (C) 2012-2015 John W. Eaton |
13193
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 ## |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
3 ## This file is part of Octave. |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
4 ## |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
5 ## Octave is free software; you can redistribute it and/or modify it |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
6 ## under the terms of the GNU General Public License as published by |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
8 ## your option) any later version. |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
9 ## |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
10 ## Octave is distributed in the hope that it will be useful, but |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
13 ## General Public License for more details. |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
14 ## |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
15 ## You should have received a copy of the GNU General Public License |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
16 ## along with Octave; see the file COPYING. If not, see |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
17 ## <http://www.gnu.org/licenses/>. |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
18 |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
19 %% Test script for legacy OOP. |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
20 %% Requires the path to contain the directory ctor-vs-method. |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
21 %% |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
22 %% Note: This script and all classes are also intended to run |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
23 %% in Matlab to test compatibility. Don't break that! |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
24 |
18482
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
25 %% FIXME: Can't use 'clear -classes' because it also clears all functions in the |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
26 %% namespace of test.m (bug #35881). This is a problem only if Octave would |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
27 %% re-use a class definition that was defined somewhere else. Unfortunately, |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
28 %% that is exactly the case when running 'make check' since the ctor-vs-method |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
29 %% test also uses an @parent, @derived, and @other class. |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
30 %% Until the bug is fixed, it suffices to make the class names unique so that |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
31 %% there is no re-use. Using the prefix fhdr (fcn-handle-derived-resolution) |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
32 %% for this directory. |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
33 %%!shared |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
34 %%! #clear -classes |
13193
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
36 %!test |
18482
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
37 %! p = fhdr_parent (7); |
13193
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 %! assert (numel (p), 7) |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
40 %!test |
18482
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
41 %! d = fhdr_derived (13); |
13193
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
42 %! assert (numel (d), 13) |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
43 |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
44 %!test |
18482
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
45 %! p = fhdr_parent (11); |
13193
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
46 %! f = @numel; |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
47 %! assert (f (p), 11) |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
49 %!test |
18482
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
50 %! d = fhdr_parent (21); |
13193
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
51 %! f = @numel; |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
52 %! assert (f (d), 21) |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
53 |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
54 %!test |
18482
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
55 %! o(1) = fhdr_other (13); |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
56 %! o(2) = fhdr_other (42); |
13193
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
57 %! assert (getsize_loop (o), [13, 42]) |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
58 |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
59 %!test |
18482
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
60 %! o(1) = fhdr_other (13); |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
61 %! o(2) = fhdr_other (42); |
13193
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
62 %! assert (getsize_cellfun (o), [13, 42]) |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
63 |
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
64 %!test |
18482
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
65 %! o(1) = fhdr_other (13); |
68fc31c69fcb
Workaround for clear -classes and failures in 'make check' (bug #41269)
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
66 %! o(2) = fhdr_other (42); |
13193
a00ff5cedb9b
also look to parent classes for overloaded functions called through handles
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
67 %! assert (getsize_arrayfun (o), [13, 42]) |