Refactor the test for detecting apng from png
This commit is contained in:
		
							parent
							
								
									29354d919f
								
							
						
					
					
						commit
						760d586160
					
				@ -26,28 +26,36 @@ TEST_CASE("Detect png animation", "[apng][noci]") {
 | 
				
			|||||||
  char *argv[] = { bin };
 | 
					  char *argv[] = { bin };
 | 
				
			||||||
  QGuiApplication app(argc, argv);
 | 
					  QGuiApplication app(argc, argv);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Detect apng supports animation
 | 
					  // Instantiate reader
 | 
				
			||||||
  QImageReader a("snackoo.png", "apng");
 | 
					  QImageReader reader;
 | 
				
			||||||
  REQUIRE(a.supportsAnimation());
 | 
					 | 
				
			||||||
  REQUIRE(!QPixmap::fromImage(a.read()).isNull());
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Detect png frame has no animation
 | 
					  SECTION("Decide format from content fails on apng") {
 | 
				
			||||||
  QImageReader p("snackoo-frame.png", "apng");
 | 
					    reader.setFileName("snackoo.png");
 | 
				
			||||||
  REQUIRE(!p.supportsAnimation());
 | 
					    reader.setDecideFormatFromContent(true);
 | 
				
			||||||
  p.setFormat("png");
 | 
					    REQUIRE(!reader.supportsAnimation());
 | 
				
			||||||
  REQUIRE(!QPixmap::fromImage(p.read()).isNull());
 | 
					    REQUIRE(!QPixmap::fromImage(reader.read()).isNull());
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  // Auto detect fails on apng
 | 
					
 | 
				
			||||||
  QImageReader d;
 | 
					  SECTION("Auto detect fails on apng") {
 | 
				
			||||||
  d.setAutoDetectImageFormat(true);
 | 
					    reader.setFileName("snackoo.png");
 | 
				
			||||||
  d.setFileName("snackoo.png");
 | 
					    reader.setAutoDetectImageFormat(true);
 | 
				
			||||||
  REQUIRE(!d.supportsAnimation());
 | 
					    REQUIRE(!reader.supportsAnimation());
 | 
				
			||||||
  REQUIRE(!QPixmap::fromImage(d.read()).isNull());
 | 
					    REQUIRE(!QPixmap::fromImage(reader.read()).isNull());
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  // Decide format fom content fails on apng
 | 
					
 | 
				
			||||||
  QImageReader c;
 | 
					  SECTION("Detect apng supports animation") {
 | 
				
			||||||
  c.setDecideFormatFromContent(true);
 | 
					    reader.setFileName("snackoo.png");
 | 
				
			||||||
  c.setFileName("snackoo.png");
 | 
					    reader.setFormat("apng");
 | 
				
			||||||
  REQUIRE(!c.supportsAnimation());
 | 
					    REQUIRE(reader.supportsAnimation());
 | 
				
			||||||
  REQUIRE(!QPixmap::fromImage(c.read()).isNull());
 | 
					    REQUIRE(!QPixmap::fromImage(reader.read()).isNull());
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  SECTION("Detect png frame has no animation") {
 | 
				
			||||||
 | 
					    reader.setFileName("snackoo-frame.png");
 | 
				
			||||||
 | 
					    reader.setFormat("apng");
 | 
				
			||||||
 | 
					    REQUIRE(!reader.supportsAnimation());
 | 
				
			||||||
 | 
					    reader.setFormat("png");
 | 
				
			||||||
 | 
					    REQUIRE(!reader.supportsAnimation());
 | 
				
			||||||
 | 
					    REQUIRE(!QPixmap::fromImage(reader.read()).isNull());
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user