Fix: image binary data being retained in bee file after deleting

This commit is contained in:
Rebecca Breu 2023-11-25 21:14:02 +01:00
parent 78963119e0
commit 3311294ccd
3 changed files with 11 additions and 0 deletions

View file

@ -9,6 +9,12 @@ Added
JPG. In the newly created settings dialog, this behaviour can be
changed to always use PNG (the former behaviour) always JPG.
Fixed
-----
* Fixed a bug where the binary data of deleted images would still hang
around in the bee file.
0.3.0 - 2023-11-23
==================

View file

@ -261,6 +261,7 @@ class SQLiteIO:
def delete_items(self, to_delete):
self.exmany('DELETE FROM items WHERE id=?', to_delete)
self.exmany('DELETE FROM sqlar WHERE item_id=?', to_delete)
self.connection.commit()
def insert_item(self, item):

View file

@ -388,8 +388,12 @@ def test_sqliteio_write_removes_nonexisting_pixmap_item(tmpfile, view):
view.scene.addItem(item)
io = SQLiteIO(tmpfile, view.scene, create_new=True)
io.write()
assert io.fetchone('SELECT COUNT(*) from items') == (1,)
assert io.fetchone('SELECT COUNT(*) from sqlar') == (1,)
view.scene.removeItem(item)
io = SQLiteIO(tmpfile, view.scene, create_new=False)
io.create_new = False
io.write()