fixed some bugs in the unit tests

uninitialized var: most tests were not initializing
  the total_tests variable to 0

window dealloc: api_test was mistakenly allocating windows
  when it meant to be deallocating windows :p
Merge branch 'master' into port_osx