volume() public method

public volume ( $force = false )
Example #1
0
 /**
  * @covers ColorThief\VBox::volume
  */
 public function testVolume()
 {
     $this->vbox->r1 = 0;
     $this->vbox->r2 = 0;
     $this->vbox->g1 = 0;
     $this->vbox->g2 = 0;
     $this->vbox->b1 = 0;
     $this->vbox->b2 = 0;
     $this->assertSame(1, $this->vbox->volume());
     $this->vbox->r2 = 255;
     $this->vbox->g2 = 255;
     $this->vbox->b2 = 255;
     // Previous result should be cached.
     $this->assertSame(1, $this->vbox->volume());
     // Forcing refresh should now give the right result
     $this->assertSame(16777216, $this->vbox->volume(true));
 }