]> gitweb.factorcode.org Git - factor.git/blob - extra/images/viewer/viewer-tests.factor
factor: clean up spaces in -tests files
[factor.git] / extra / images / viewer / viewer-tests.factor
1 ! Copyright (C) 2010 Jon Harper.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: tools.test images.viewer images.viewer.private kernel accessors sequences images
4 namespaces ui ui.gadgets.debug math opengl.textures opengl.textures.private
5 models ;
6 IN: images.viewer.tests
7
8 : (gen-image) ( dim -- bitmap )
9     product 3 * [ 200 ] BV{ } replicate-as ;
10 : gen-image ( dim -- image )
11     dup (gen-image) <image> swap >>bitmap swap >>dim
12     RGB >>component-order ubyte-components >>component-type ;
13
14 [ ] [ { 50 50 } gen-image "s" set ] unit-test
15 [ ] [ "s" get <image-gadget> "ig" set ] unit-test
16 "ig" get [
17    [ t ] [ "ig" get image-gadget-texture single-texture? ] unit-test
18 ] with-grafted-gadget
19
20 [ ] [ "s" get <model> "m" set ] unit-test
21 [ ] [ { 150 150 } gen-image "s1" set ] unit-test
22 [ ] [ "m" get <image-control> "ic" set ] unit-test
23 "ic" get [
24    [ t ] [ "ic" get image-gadget-texture single-texture? ] unit-test
25    [ { 50 50 } ] [ "ic" get texture>> texture-size ] unit-test
26 ] with-grafted-gadget
27
28 ! TODO
29 ! test that when changing the model, the gadget updates the texture.
30 ! - same size images (both smaller than 512x512) (updates)
31 ! test that when changing the model, the gadget creates a new texture.
32 ! test different cases : 
33 ! - same size images (both bigger than 512x512) (creates)
34 ! - different size images (both smaller than 512x512) (creates)
35 ! - different size images (both bigger than 512x512) (creates)
36 ! - different size images (1 smaller than, 1 bigger than 512x512)