Author: Lars Wassermann <lars.wasserm...@gmail.com> Branch: Changeset: r500:8f1a3b5e4c46 Date: 2013-07-16 16:19 +0200 http://bitbucket.org/pypy/lang-smalltalk/changeset/8f1a3b5e4c46/
Log: greened tests diff --git a/spyvm/model.py b/spyvm/model.py --- a/spyvm/model.py +++ b/spyvm/model.py @@ -879,7 +879,7 @@ def getword(self, n): # if n < 0: # import pdb; pdb.set_trace() - assert n >= 0 + assert self.size() > n >= 0 if self.words is not None: return self.words[n] else: @@ -1006,7 +1006,7 @@ return w_result def getword(self, n): - assert n >= 0 + assert self.size() > n >= 0 # if self._realsize > n: return self._real_depth_buffer[n] # else: diff --git a/spyvm/shadow.py b/spyvm/shadow.py --- a/spyvm/shadow.py +++ b/spyvm/shadow.py @@ -1282,7 +1282,7 @@ def copy_loop(self): space = self.space no_skew_mask = ~self.skew_mask - for i in xrange(1, self.h+1): + for i in xrange(1, self.h + 1): if self.halftone_bits: halftone_word = self.halftone_bits[self.dy % len(self.halftone_bits)] self.dy = self.dy + self.v_dir @@ -1298,7 +1298,7 @@ for word in xrange(1, self.n_words + 1): if self.source_form is not None: prev_word = prev_word & self.skew_mask - if (self.source_index < 0 + if (self.source_index < 0 or self.source_index >= self.source_bits.size()): this_word = self.source_bits.getword(0) else: @@ -1392,6 +1392,11 @@ _attrs_ = ["w_bits", "width", "height", "depth", "offset_x", "offset_y"] def sync_cache(self): + if self.size() < 5: + w_self = self.w_self() + assert isinstance(w_self, model.W_PointersObject) + w_self._shadow = None + raise error.PrimitiveFailedError self.w_bits = self.fetch(0) if not (isinstance(self.w_bits, model.W_WordsObject) or isinstance(self.w_bits, model.W_DisplayBitmap)): w_self = self.w_self() diff --git a/spyvm/test/test_primitives.py b/spyvm/test/test_primitives.py --- a/spyvm/test/test_primitives.py +++ b/spyvm/test/test_primitives.py @@ -776,12 +776,16 @@ assert argcount == 0 raise CallCopyBitsSimulation + def sync_cache_mock(self): + raise CallCopyBitsSimulation + interp, w_frame, argument_count = mock([mock_bitblt], None) if interp.image is None: interp.image = Image() try: monkeypatch.setattr(w_frame._shadow, "_sendSelfSelector", perform_mock) + monkeypatch.setattr(shadow.BitBltShadow, "sync_cache", sync_cache_mock) with py.test.raises(CallCopyBitsSimulation): prim_table[primitives.BITBLT_COPY_BITS](interp, w_frame.as_context_get_shadow(space), argument_count-1) finally: _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit