|
3 | 3 | import numpy |
4 | 4 |
|
5 | 5 | class TestVCSBackgroundModeRotate(basevcstest.VCSBaseTest): |
6 | | - def testBackgroundModeRotate(self): |
| 6 | + def testBackgroundModeRotate(self): |
7 | 7 |
|
8 | | - data = numpy.sin(numpy.arange(100)) |
9 | | - data = numpy.reshape(data, (10, 10)) |
| 8 | + data = numpy.sin(numpy.arange(100)) |
| 9 | + data = numpy.reshape(data, (10, 10)) |
10 | 10 |
|
11 | | - self.x = vcs.init() |
12 | | - self.x.plot(data, bg=self.bg) |
13 | | - self.assertEqual(self.x.orientation(), "landscape", "Default canvas orientation failed") |
14 | | - c = self.x.canvasinfo() |
15 | | - self.assertEqual(c['width'], 814, "Default canvas width failed") |
16 | | - self.assertEqual(c['height'], 606, "Default canvas height failed") |
| 11 | + self.x = vcs.init() |
| 12 | + self.x.plot(data, bg=self.bg) |
| 13 | + self.assertEqual(self.x.orientation(), "landscape", "Default canvas orientation failed") |
| 14 | + c = self.x.canvasinfo() |
| 15 | + # default window size is based on the screen size |
| 16 | + width = c['width'] |
| 17 | + height = c['height'] |
17 | 18 |
|
18 | | - self.x.clear() |
19 | | - self.x.portrait() |
20 | | - self.x.plot(data, bg=self.bg) |
21 | | - self.assertEqual( self.x.orientation(), "portrait", "Portrait canvas orientation failed") |
22 | | - c = self.x.canvasinfo() |
23 | | - self.assertEqual( c['width'], 606, "Portrait canvas width failed") |
24 | | - self.assertEqual( c['height'], 814, "Portrait canvas height failed") |
| 19 | + self.x.clear() |
| 20 | + self.x.portrait() |
| 21 | + self.x.plot(data, bg=self.bg) |
| 22 | + self.assertEqual( self.x.orientation(), "portrait", "Portrait canvas orientation failed") |
| 23 | + c = self.x.canvasinfo() |
| 24 | + self.assertEqual( c['width'], height, "Portrait canvas width failed") |
| 25 | + self.assertEqual( c['height'], width, "Portrait canvas height failed") |
25 | 26 |
|
26 | | - self.x.clear() |
27 | | - self.x.landscape() |
28 | | - self.x.plot(data, bg=self.bg) |
29 | | - self.assertEqual( self.x.orientation(), "landscape", "Landscape canvas orientation failed") |
30 | | - c = self.x.canvasinfo() |
31 | | - self.assertEqual( c['width'], 814, "Landscape canvas width failed") |
32 | | - self.assertEqual( c['height'], 606, "Landscape canvas height failed") |
| 27 | + self.x.clear() |
| 28 | + self.x.landscape() |
| 29 | + self.x.plot(data, bg=self.bg) |
| 30 | + self.assertEqual( self.x.orientation(), "landscape", "Landscape canvas orientation failed") |
| 31 | + c = self.x.canvasinfo() |
| 32 | + self.assertEqual( c['width'], width, "Landscape canvas width failed") |
| 33 | + self.assertEqual( c['height'], height, "Landscape canvas height failed") |
33 | 34 |
|
34 | | - self.x.clear() |
35 | | - self.x.landscape() |
36 | | - self.x.plot(data, bg=self.bg) |
37 | | - self.assertEqual( self.x.orientation(), "landscape", "Landscape canvas orientation failed") |
38 | | - c = self.x.canvasinfo() |
39 | | - self.assertEqual( c['width'], 814, "Landscape canvas width failed") |
40 | | - self.assertEqual( c['height'], 606, "Landscape canvas height failed") |
| 35 | + self.x.clear() |
| 36 | + self.x.landscape() |
| 37 | + self.x.plot(data, bg=self.bg) |
| 38 | + self.assertEqual( self.x.orientation(), "landscape", "Landscape canvas orientation failed") |
| 39 | + c = self.x.canvasinfo() |
| 40 | + self.assertEqual( c['width'], width, "Landscape canvas width failed") |
| 41 | + self.assertEqual( c['height'], height, "Landscape canvas height failed") |
41 | 42 |
|
42 | | - self.x.clear() |
43 | | - self.x.portrait() |
44 | | - self.x.plot(data, bg=self.bg) |
45 | | - self.assertEqual( self.x.orientation(), "portrait", "Portrait canvas orientation failed") |
46 | | - c = self.x.canvasinfo() |
47 | | - self.assertEqual( c['width'], 606, "Portrait canvas width failed") |
48 | | - self.assertEqual( c['height'], 814, "Portrait canvas height failed") |
| 43 | + self.x.clear() |
| 44 | + self.x.portrait() |
| 45 | + self.x.plot(data, bg=self.bg) |
| 46 | + self.assertEqual( self.x.orientation(), "portrait", "Portrait canvas orientation failed") |
| 47 | + c = self.x.canvasinfo() |
| 48 | + self.assertEqual( c['width'], height, "Portrait canvas width failed") |
| 49 | + self.assertEqual( c['height'], width, "Portrait canvas height failed") |
0 commit comments