{"action":"created","issue":{"url":"https://api.github.com/repos/heuer/pyqrcode/issues/8","repository_url":"https://api.github.com/repos/heuer/pyqrcode","labels_url":"https://api.github.com/repos/heuer/pyqrcode/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/heuer/pyqrcode/issues/8/comments","events_url":"https://api.github.com/repos/heuer/pyqrcode/issues/8/events","html_url":"https://github.com/heuer/pyqrcode/issues/8","id":335881302,"node_id":"MDU6SXNzdWUzMzU4ODEzMDI=","number":8,"title":"xbm does not handle scale correctly","user":{"login":"heuer","id":364926,"node_id":"MDQ6VXNlcjM2NDkyNg==","avatar_url":"https://avatars0.githubusercontent.com/u/364926?v=4","gravatar_id":"","url":"https://api.github.com/users/heuer","html_url":"https://github.com/heuer","followers_url":"https://api.github.com/users/heuer/followers","following_url":"https://api.github.com/users/heuer/following{/other_user}","gists_url":"https://api.github.com/users/heuer/gists{/gist_id}","starred_url":"https://api.github.com/users/heuer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heuer/subscriptions","organizations_url":"https://api.github.com/users/heuer/orgs","repos_url":"https://api.github.com/users/heuer/repos","events_url":"https://api.github.com/users/heuer/events{/privacy}","received_events_url":"https://api.github.com/users/heuer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-26T15:44:51Z","updated_at":"2018-06-26T15:57:20Z","closed_at":null,"author_association":"OWNER","body":"````python\r\nqr = pyqrcode.create('Test', error='h')\r\nqr.png('test_scale.png', scale=4)\r\n````\r\n\r\nConvert that result into xbm via The Gimp.\r\n\r\nTest case\r\n````python\r\ndef test_xbm_scale():\r\n    \"\"\"Test the xbm render against a known good.\r\n\r\n    This test checks the *values* contained in the XBM, not the text.\r\n    \"\"\"\r\n    expected_width_scale = '''#define im_width 116\r\n#define im_height 116\r\nstatic unsigned short im_bits[] = {\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0xffff, 0x0fff, 0x000f, 0xff0f, 0xffff, 0x000f,\r\n   0x0000, 0x0000, 0xffff, 0x0fff, 0x000f, 0xff0f, 0xffff, 0x000f, 0x0000,\r\n   0x0000, 0xffff, 0x0fff, 0x000f, 0xff0f, 0xffff, 0x000f, 0x0000, 0x0000,\r\n   0xffff, 0x0fff, 0x000f, 0xff0f, 0xffff, 0x000f, 0x0000, 0x0000, 0x000f,\r\n   0x0f00, 0xfff0, 0x0f0f, 0x0000, 0x000f, 0x0000, 0x0000, 0x000f, 0x0f00,\r\n   0xfff0, 0x0f0f, 0x0000, 0x000f, 0x0000, 0x0000, 0x000f, 0x0f00, 0xfff0,\r\n   0x0f0f, 0x0000, 0x000f, 0x0000, 0x0000, 0x000f, 0x0f00, 0xfff0, 0x0f0f,\r\n   0x0000, 0x000f, 0x0000, 0x0000, 0xff0f, 0x0f0f, 0xf0ff, 0x0f0f, 0x0fff,\r\n   0x000f, 0x0000, 0x0000, 0xff0f, 0x0f0f, 0xf0ff, 0x0f0f, 0x0fff, 0x000f,\r\n   0x0000, 0x0000, 0xff0f, 0x0f0f, 0xf0ff, 0x0f0f, 0x0fff, 0x000f, 0x0000,\r\n   0x0000, 0xff0f, 0x0f0f, 0xf0ff, 0x0f0f, 0x0fff, 0x000f, 0x0000, 0x0000,\r\n   0xff0f, 0x0f0f, 0xff00, 0x0f00, 0x0fff, 0x000f, 0x0000, 0x0000, 0xff0f,\r\n   0x0f0f, 0xff00, 0x0f00, 0x0fff, 0x000f, 0x0000, 0x0000, 0xff0f, 0x0f0f,\r\n   0xff00, 0x0f00, 0x0fff, 0x000f, 0x0000, 0x0000, 0xff0f, 0x0f0f, 0xff00,\r\n   0x0f00, 0x0fff, 0x000f, 0x0000, 0x0000, 0xff0f, 0x0f0f, 0xf0ff, 0x0f00,\r\n   0x0fff, 0x000f, 0x0000, 0x0000, 0xff0f, 0x0f0f, 0xf0ff, 0x0f00, 0x0fff,\r\n   0x000f, 0x0000, 0x0000, 0xff0f, 0x0f0f, 0xf0ff, 0x0f00, 0x0fff, 0x000f,\r\n   0x0000, 0x0000, 0xff0f, 0x0f0f, 0xf0ff, 0x0f00, 0x0fff, 0x000f, 0x0000,\r\n   0x0000, 0x000f, 0x0f00, 0x00f0, 0x0f0f, 0x0000, 0x000f, 0x0000, 0x0000,\r\n   0x000f, 0x0f00, 0x00f0, 0x0f0f, 0x0000, 0x000f, 0x0000, 0x0000, 0x000f,\r\n   0x0f00, 0x00f0, 0x0f0f, 0x0000, 0x000f, 0x0000, 0x0000, 0x000f, 0x0f00,\r\n   0x00f0, 0x0f0f, 0x0000, 0x000f, 0x0000, 0x0000, 0xffff, 0x0fff, 0x0f0f,\r\n   0xff0f, 0xffff, 0x000f, 0x0000, 0x0000, 0xffff, 0x0fff, 0x0f0f, 0xff0f,\r\n   0xffff, 0x000f, 0x0000, 0x0000, 0xffff, 0x0fff, 0x0f0f, 0xff0f, 0xffff,\r\n   0x000f, 0x0000, 0x0000, 0xffff, 0x0fff, 0x0f0f, 0xff0f, 0xffff, 0x000f,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0fff, 0x000f, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0fff, 0x000f, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0fff, 0x000f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0fff, 0x000f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0ff0,\r\n   0x0000, 0x0f0f, 0x0f0f, 0x000f, 0x0000, 0x0000, 0x0000, 0x0ff0, 0x0000,\r\n   0x0f0f, 0x0f0f, 0x000f, 0x0000, 0x0000, 0x0000, 0x0ff0, 0x0000, 0x0f0f,\r\n   0x0f0f, 0x000f, 0x0000, 0x0000, 0x0000, 0x0ff0, 0x0000, 0x0f0f, 0x0f0f,\r\n   0x000f, 0x0000, 0x0000, 0xffff, 0x0000, 0xffff, 0x0ff0, 0x0fff, 0x0000,\r\n   0x0000, 0x0000, 0xffff, 0x0000, 0xffff, 0x0ff0, 0x0fff, 0x0000, 0x0000,\r\n   0x0000, 0xffff, 0x0000, 0xffff, 0x0ff0, 0x0fff, 0x0000, 0x0000, 0x0000,\r\n   0xffff, 0x0000, 0xffff, 0x0ff0, 0x0fff, 0x0000, 0x0000, 0x0000, 0xff00,\r\n   0x0f0f, 0xf0ff, 0x00ff, 0xffff, 0x0000, 0x0000, 0x0000, 0xff00, 0x0f0f,\r\n   0xf0ff, 0x00ff, 0xffff, 0x0000, 0x0000, 0x0000, 0xff00, 0x0f0f, 0xf0ff,\r\n   0x00ff, 0xffff, 0x0000, 0x0000, 0x0000, 0xff00, 0x0f0f, 0xf0ff, 0x00ff,\r\n   0xffff, 0x0000, 0x0000, 0x0000, 0xf000, 0x00f0, 0xf000, 0x0000, 0x0fff,\r\n   0x0000, 0x0000, 0x0000, 0xf000, 0x00f0, 0xf000, 0x0000, 0x0fff, 0x0000,\r\n   0x0000, 0x0000, 0xf000, 0x00f0, 0xf000, 0x0000, 0x0fff, 0x0000, 0x0000,\r\n   0x0000, 0xf000, 0x00f0, 0xf000, 0x0000, 0x0fff, 0x0000, 0x0000, 0x0000,\r\n   0x0f00, 0x0f00, 0xff0f, 0x0ff0, 0x0000, 0x000f, 0x0000, 0x0000, 0x0f00,\r\n   0x0f00, 0xff0f, 0x0ff0, 0x0000, 0x000f, 0x0000, 0x0000, 0x0f00, 0x0f00,\r\n   0xff0f, 0x0ff0, 0x0000, 0x000f, 0x0000, 0x0000, 0x0f00, 0x0f00, 0xff0f,\r\n   0x0ff0, 0x0000, 0x000f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0xff00,\r\n   0xff00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0xff00, 0xff00,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0xff00, 0xff00, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0xff00, 0xff00, 0x0000, 0x0000,\r\n   0x0000, 0xffff, 0x0fff, 0x0f00, 0xff00, 0xf0f0, 0x0000, 0x0000, 0x0000,\r\n   0xffff, 0x0fff, 0x0f00, 0xff00, 0xf0f0, 0x0000, 0x0000, 0x0000, 0xffff,\r\n   0x0fff, 0x0f00, 0xff00, 0xf0f0, 0x0000, 0x0000, 0x0000, 0xffff, 0x0fff,\r\n   0x0f00, 0xff00, 0xf0f0, 0x0000, 0x0000, 0x0000, 0x000f, 0x0f00, 0xf0ff,\r\n   0xf0ff, 0x0fff, 0x000f, 0x0000, 0x0000, 0x000f, 0x0f00, 0xf0ff, 0xf0ff,\r\n   0x0fff, 0x000f, 0x0000, 0x0000, 0x000f, 0x0f00, 0xf0ff, 0xf0ff, 0x0fff,\r\n   0x000f, 0x0000, 0x0000, 0x000f, 0x0f00, 0xf0ff, 0xf0ff, 0x0fff, 0x000f,\r\n   0x0000, 0x0000, 0xff0f, 0x0f0f, 0x0f00, 0xf0f0, 0xf0f0, 0x0000, 0x0000,\r\n   0x0000, 0xff0f, 0x0f0f, 0x0f00, 0xf0f0, 0xf0f0, 0x0000, 0x0000, 0x0000,\r\n   0xff0f, 0x0f0f, 0x0f00, 0xf0f0, 0xf0f0, 0x0000, 0x0000, 0x0000, 0xff0f,\r\n   0x0f0f, 0x0f00, 0xf0f0, 0xf0f0, 0x0000, 0x0000, 0x0000, 0xff0f, 0x0f0f,\r\n   0xfff0, 0x0ff0, 0x0ff0, 0x0000, 0x0000, 0x0000, 0xff0f, 0x0f0f, 0xfff0,\r\n   0x0ff0, 0x0ff0, 0x0000, 0x0000, 0x0000, 0xff0f, 0x0f0f, 0xfff0, 0x0ff0,\r\n   0x0ff0, 0x0000, 0x0000, 0x0000, 0xff0f, 0x0f0f, 0xfff0, 0x0ff0, 0x0ff0,\r\n   0x0000, 0x0000, 0x0000, 0xff0f, 0x0f0f, 0x00f0, 0x00ff, 0xfff0, 0x000f,\r\n   0x0000, 0x0000, 0xff0f, 0x0f0f, 0x00f0, 0x00ff, 0xfff0, 0x000f, 0x0000,\r\n   0x0000, 0xff0f, 0x0f0f, 0x00f0, 0x00ff, 0xfff0, 0x000f, 0x0000, 0x0000,\r\n   0xff0f, 0x0f0f, 0x00f0, 0x00ff, 0xfff0, 0x000f, 0x0000, 0x0000, 0x000f,\r\n   0x0f00, 0x0ff0, 0x0fff, 0x0f0f, 0x0000, 0x0000, 0x0000, 0x000f, 0x0f00,\r\n   0x0ff0, 0x0fff, 0x0f0f, 0x0000, 0x0000, 0x0000, 0x000f, 0x0f00, 0x0ff0,\r\n   0x0fff, 0x0f0f, 0x0000, 0x0000, 0x0000, 0x000f, 0x0f00, 0x0ff0, 0x0fff,\r\n   0x0f0f, 0x0000, 0x0000, 0x0000, 0xffff, 0x0fff, 0xf0f0, 0x0f0f, 0xff0f,\r\n   0x0000, 0x0000, 0x0000, 0xffff, 0x0fff, 0xf0f0, 0x0f0f, 0xff0f, 0x0000,\r\n   0x0000, 0x0000, 0xffff, 0x0fff, 0xf0f0, 0x0f0f, 0xff0f, 0x0000, 0x0000,\r\n   0x0000, 0xffff, 0x0fff, 0xf0f0, 0x0f0f, 0xff0f, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r\n   0x0000 };\r\n'''\r\n\r\n    c = pyqrcode.create('Test').xbm(scale=4)\r\n\r\n    # Testing number-by-number to get more useful failure message\r\n    c_width, c_height, c_bits = decompose_xbm(c)\r\n    expected_width, expected_height, expected_bits = decompose_xbm(expected_width_scale)\r\n\r\n    # Check the there is the same width and height\r\n    assert c_width == expected_width\r\n    assert c_height == expected_height\r\n\r\n    # Check that there is the same number of bits\r\n    assert len(expected_bits) == len(c_bits)\r\n\r\n    # Check the bit values\r\n    for i in range(len(expected_bits)):\r\n        assert c_bits[i] == expected_bits[i], \"Wrong value at {0}: {1} != {2}\".format(i, c_bits[i], expected_bits[i])\r\n````\r\n\r\nResult: \r\n````\r\n>       assert len(expected_bits) == len(c_bits)\r\nE       AssertionError: assert 600 == 1064\r\nE        +  where 600 = len(['0x00', '0x00', '0x00', '0x00', '0x00', '0x00', ...])\r\nE        +  and   1064 = len(['0x00', '0x00', '0x00', '0x00', '0x00', '0x00', ...])\r\n````"},"comment":{"url":"https://api.github.com/repos/heuer/pyqrcode/issues/comments/400364632","html_url":"https://github.com/heuer/pyqrcode/issues/8#issuecomment-400364632","issue_url":"https://api.github.com/repos/heuer/pyqrcode/issues/8","id":400364632,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMDM2NDYzMg==","user":{"login":"heuer","id":364926,"node_id":"MDQ6VXNlcjM2NDkyNg==","avatar_url":"https://avatars0.githubusercontent.com/u/364926?v=4","gravatar_id":"","url":"https://api.github.com/users/heuer","html_url":"https://github.com/heuer","followers_url":"https://api.github.com/users/heuer/followers","following_url":"https://api.github.com/users/heuer/following{/other_user}","gists_url":"https://api.github.com/users/heuer/gists{/gist_id}","starred_url":"https://api.github.com/users/heuer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heuer/subscriptions","organizations_url":"https://api.github.com/users/heuer/orgs","repos_url":"https://api.github.com/users/heuer/repos","events_url":"https://api.github.com/users/heuer/events{/privacy}","received_events_url":"https://api.github.com/users/heuer/received_events","type":"User","site_admin":false},"created_at":"2018-06-26T15:57:20Z","updated_at":"2018-06-26T15:57:20Z","author_association":"OWNER","body":"The resulting XBM file can be imported by The Gimp, though"}}
{"actor":{"display_login":"heuer"}}