| 1 | """ |
| 2 | Copyright (C) 2013 Mayank Jha <[email protected]> |
| 3 | |
| 4 | This library is free software; you can redistribute it and/or modify |
| 5 | it under the terms of the GNU Lesser General Public License as published |
| 6 | by the Free Software Foundation; either version 2.1 of the License, or |
| 7 | (at your option) any later version. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | GNU General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public License |
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | """ |
| 17 | """ |
| 18 | Copyright (C) 2013 Mayank Jha <[email protected]> |
| 19 | |
| 20 | This library is free software; you can redistribute it and/or modify |
| 21 | it under the terms of the GNU Lesser General Public License as published |
| 22 | by the Free Software Foundation; either version 2.1 of the License, or |
| 23 | (at your option) any later version. |
| 24 | |
| 25 | This program is distributed in the hope that it will be useful, |
| 26 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 27 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 28 | GNU General Public License for more details. |
| 29 | |
| 30 | You should have received a copy of the GNU Lesser General Public License |
| 31 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 32 | """ |
| 33 | import os |
| 34 | from fc.BitmapHandler import BitmapCompare |
| 35 | import shutil |
| 36 | import pkg_resources |
| 37 | |
| 38 | class DocCompare: |
| 39 | def basicCompare(self,testpath, mockfont, fontsize): |
| 40 | docpath = pkg_resources.resource_filename("fc","docs/doc.txt") |
| 41 | bashcommand = "hb-view --output-format=\"png\" --output-file=\"/var/tmp/test.png\" --font-size="+str(fontsize)+" --text-file=\"" |
| 42 | bashcommand+=docpath+"\" "+"\""+testpath+"\"" |
| 43 | os.system(str(bashcommand)) |
| 44 | print bashcommand |
| 45 | thefile = pkg_resources.resource_filename("fc",mockfont.highresdocfile) |
| 46 | shutil.copy(thefile,"/var/tmp/standard.png") |
| 47 | cm = BitmapCompare() |
| 48 | score = cm.basicCompare("/var/tmp/test.png",\ |
| 49 | "/var/tmp/standard.png",1000,0,True) |