Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: ppapi/tests/test_graphics_2d.cc

Issue 10832428: Add a query function for the scaling feature. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test fixed Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/tests/test_graphics_2d.h" 5 #include "ppapi/tests/test_graphics_2d.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "ppapi/c/dev/ppb_testing_dev.h" 10 #include "ppapi/c/dev/ppb_testing_dev.h"
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 } else { 625 } else {
626 if (rv == PP_OK || rv == PP_OK_COMPLETIONPENDING) 626 if (rv == PP_OK || rv == PP_OK_COMPLETIONPENDING)
627 return "Second flush succeeded before callback ran."; 627 return "Second flush succeeded before callback ran.";
628 } 628 }
629 } 629 }
630 630
631 PASS(); 631 PASS();
632 } 632 }
633 633
634 std::string TestGraphics2D::TestDev() { 634 std::string TestGraphics2D::TestDev() {
635 // Tests GetScale/SetScale via the Graphics2DDev C++ wrapper 635 // Tests GetScale/SetScale via the Graphics2D_Dev C++ wrapper
636 const int w=20, h=16; 636 const int w=20, h=16;
637 const float scale=1.0f/2.0f; 637 const float scale=1.0f/2.0f;
638 pp::Graphics2D dc(instance_, pp::Size(w, h), false); 638 pp::Graphics2D dc(instance_, pp::Size(w, h), false);
639 if (dc.is_null()) 639 if (dc.is_null())
640 return "Failure creating a boring device"; 640 return "Failure creating a boring device";
641 pp::Graphics2DDev dc_dev(dc); 641 pp::Graphics2D_Dev dc_dev(dc);
642 if (dc_dev.GetScale() != 1.0f) 642 if (dc_dev.GetScale() != 1.0f)
643 return "GetScale returned unexpected value before SetScale"; 643 return "GetScale returned unexpected value before SetScale";
644 if (!dc_dev.SetScale(scale)) 644 if (!dc_dev.SetScale(scale))
645 return "SetScale failed"; 645 return "SetScale failed";
646 if (dc_dev.GetScale() != scale) 646 if (dc_dev.GetScale() != scale)
647 return "GetScale mismatch with prior SetScale"; 647 return "GetScale mismatch with prior SetScale";
648 // Try setting a few invalid scale factors. Ensure that we catch these errors 648 // Try setting a few invalid scale factors. Ensure that we catch these errors
649 // and don't change the actual scale 649 // and don't change the actual scale
650 if (dc_dev.SetScale(-1.0f)) 650 if (dc_dev.SetScale(-1.0f))
651 return "SetScale(-1f) did not fail"; 651 return "SetScale(-1f) did not fail";
(...skipping 10 matching lines...) Expand all
662 PP_Bool is_always_opaque = PP_FALSE; 662 PP_Bool is_always_opaque = PP_FALSE;
663 if (!graphics_2d_interface_->Describe(dc_dev.pp_resource(), &size, 663 if (!graphics_2d_interface_->Describe(dc_dev.pp_resource(), &size,
664 &is_always_opaque)) 664 &is_always_opaque))
665 return "Describe failed"; 665 return "Describe failed";
666 if (size.width != w || size.height != h || 666 if (size.width != w || size.height != h ||
667 is_always_opaque != PP_FromBool(false)) 667 is_always_opaque != PP_FromBool(false))
668 return "Mismatch of data."; 668 return "Mismatch of data.";
669 669
670 PASS(); 670 PASS();
671 } 671 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698