1+ function test_suite = test_initFixation % #ok<*STOUT>
2+ try % assignment of 'localfunctions' is necessary in Matlab >= 2016
3+ test_functions = localfunctions(); % #ok<*NASGU>
4+ catch % no problem; early Matlab versions can use initTestSuite fine
5+ end
6+ initTestSuite ;
7+ end
8+
9+ function test_initFixationBasic()
10+
11+ cfg.screen.ppd = 10 ;
12+ cfg.fixation.type = ' cross' ;
13+ cfg.fixation.width = 1 ;
14+ cfg.fixation.xDisplacement = 1 ;
15+ cfg.fixation.yDisplacement = 1 ;
16+
17+ cfg = initFixation(cfg );
18+
19+ cfg .fixation
20+
21+ expectedStruct.screen.ppd = 10 ;
22+ expectedStruct.fixation.type = ' cross' ;
23+ expectedStruct.fixation.width = 1 ;
24+ expectedStruct.fixation.xDisplacement = 1 ;
25+ expectedStruct.fixation.yDisplacement = 1 ;
26+ expectedStruct.fixation.widthPix = 10 ;
27+ expectedStruct.fixation.xDisplacementPix = 10 ;
28+ expectedStruct.fixation.yDisplacementPix = 10 ;
29+ expectedStruct.fixation.xCoords = [5 15 10 10 ];
30+ expectedStruct.fixation.yCoords = [10 10 5 15 ];
31+ expectedStruct.fixation.allCoords = [5 15 10 10 ; 10 10 5 15 ];
32+
33+ assertEqual(expectedStruct , cfg )
34+
35+
36+ end
37+
38+
39+ function test_initFixationBestFixation()
40+
41+ cfg.screen.ppd = 10 ;
42+ cfg.screen.center = [100 100 ];
43+ cfg.fixation.type = ' bestFixation' ;
44+ cfg.fixation.width = 1 ;
45+ cfg.fixation.xDisplacement = 1 ;
46+ cfg.fixation.yDisplacement = 1 ;
47+
48+ cfg = initFixation(cfg );
49+
50+ cfg .fixation
51+
52+ expectedStruct.screen.ppd = 10 ;
53+ expectedStruct.screen.center = [100 100 ];
54+ expectedStruct.fixation.type = ' bestFixation' ;
55+ expectedStruct.fixation.width = 1 ;
56+ expectedStruct.fixation.xDisplacement = 1 ;
57+ expectedStruct.fixation.yDisplacement = 1 ;
58+ expectedStruct.fixation.widthPix = 10 ;
59+ expectedStruct.fixation.xDisplacementPix = 10 ;
60+ expectedStruct.fixation.yDisplacementPix = 10 ;
61+ expectedStruct.fixation.xCoords = [5 15 10 10 ];
62+ expectedStruct.fixation.yCoords = [10 10 5 15 ];
63+ expectedStruct.fixation.allCoords = [5 15 10 10 ; 10 10 5 15 ];
64+ expectedStruct.fixation.outerOval = [95 95 105 105 ];
65+ expectedStruct.fixation.innerOval = [100 - 10 / 6 , 100 - 10 / 6 , 100 + 10 / 6 , 100 + 10 / 6 ];
66+
67+ assertEqual(expectedStruct , cfg )
68+
69+
70+ end
0 commit comments