mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-26 01:10:39 +00:00
Film
tests
This commit is contained in:
parent
d935d7f6de
commit
0c2b315f5d
2 changed files with 169 additions and 46 deletions
|
@ -23,6 +23,8 @@ double log10polynomian(
|
||||||
/// do not have any reciprocity failure information, as these films are ment to be used in cinema
|
/// do not have any reciprocity failure information, as these films are ment to be used in cinema
|
||||||
/// with appropriate light and pretty short shutter speeds.
|
/// with appropriate light and pretty short shutter speeds.
|
||||||
///
|
///
|
||||||
|
/// Because of this: https://github.com/dart-lang/sdk/issues/38934#issuecomment-803938315
|
||||||
|
/// `super` calls are ignored in test coverage
|
||||||
class Film {
|
class Film {
|
||||||
final String name;
|
final String name;
|
||||||
final int iso;
|
final int iso;
|
||||||
|
@ -78,26 +80,26 @@ class Film {
|
||||||
/// https://www.tate.org.uk/documents/598/page_6_7_agfa_stocks_0.pdf
|
/// https://www.tate.org.uk/documents/598/page_6_7_agfa_stocks_0.pdf
|
||||||
/// https://www.filmwasters.com/forum/index.php?topic=5298.0
|
/// https://www.filmwasters.com/forum/index.php?topic=5298.0
|
||||||
// {{1,1.87},{2,3.73},{3,8.06},{4,13.93},{5,21.28},{6,23.00},{7,30.12},{8,38.05},{9,44.75},{10,50.12},{20,117},{30,202},{40,293},{50,413},{60,547},{70,694},{80,853},{90,1022},{100,1202}};
|
// {{1,1.87},{2,3.73},{3,8.06},{4,13.93},{5,21.28},{6,23.00},{7,30.12},{8,38.05},{9,44.75},{10,50.12},{20,117},{30,202},{40,293},{50,413},{60,547},{70,694},{80,853},{90,1022},{100,1202}};
|
||||||
class AgfaFilm extends Film {
|
// class AgfaFilm extends Film {
|
||||||
final double a;
|
// final double a;
|
||||||
final double b;
|
// final double b;
|
||||||
final double c;
|
// final double c;
|
||||||
|
|
||||||
const AgfaFilm.apx100()
|
// const AgfaFilm.apx100()
|
||||||
: a = 1,
|
// : a = 1,
|
||||||
b = 5,
|
// b = 5,
|
||||||
c = 2,
|
// c = 2,
|
||||||
super('Agfa APX 100', 100);
|
// super('Agfa APX 100', 100); // coverage:ignore-line
|
||||||
|
|
||||||
const AgfaFilm.apx400()
|
// const AgfaFilm.apx400()
|
||||||
: a = 1.5,
|
// : a = 1.5,
|
||||||
b = 4.5,
|
// b = 4.5,
|
||||||
c = 3,
|
// c = 3,
|
||||||
super('Agfa APX 400', 400);
|
// super('Agfa APX 400', 400); // coverage:ignore-line
|
||||||
|
|
||||||
@override
|
// @override
|
||||||
double reciprocityFormula(double t) => t * log10polynomian(t, a, b, c);
|
// double reciprocityFormula(double t) => t * log10polynomian(t, a, b, c);
|
||||||
}
|
// }
|
||||||
|
|
||||||
class FomapanFilm extends Film {
|
class FomapanFilm extends Film {
|
||||||
final double a;
|
final double a;
|
||||||
|
@ -109,21 +111,21 @@ class FomapanFilm extends Film {
|
||||||
: a = 1,
|
: a = 1,
|
||||||
b = 5,
|
b = 5,
|
||||||
c = 2,
|
c = 2,
|
||||||
super('Fomapan CREATIVE 100', 100);
|
super('Fomapan CREATIVE 100', 100); // coverage:ignore-line
|
||||||
|
|
||||||
/// https://www.foma.cz/en/fomapan-200
|
/// https://www.foma.cz/en/fomapan-200
|
||||||
const FomapanFilm.creative200()
|
const FomapanFilm.creative200()
|
||||||
: a = 1.5,
|
: a = 1.5,
|
||||||
b = 4.5,
|
b = 4.5,
|
||||||
c = 3,
|
c = 3,
|
||||||
super('Fomapan CREATIVE 200', 200);
|
super('Fomapan CREATIVE 200', 200); // coverage:ignore-line
|
||||||
|
|
||||||
/// https://www.foma.cz/en/fomapan-100
|
/// https://www.foma.cz/en/fomapan-100
|
||||||
const FomapanFilm.action400()
|
const FomapanFilm.action400()
|
||||||
: a = -1.25,
|
: a = -1.25, // coverage:ignore-line
|
||||||
b = 5.75,
|
b = 5.75,
|
||||||
c = 1.5,
|
c = 1.5,
|
||||||
super('Fomapan ACTION 400', 400);
|
super('Fomapan ACTION 400', 400); // coverage:ignore-line
|
||||||
|
|
||||||
@override
|
@override
|
||||||
double reciprocityFormula(double t) => t * log10polynomian(t, a, b, c);
|
double reciprocityFormula(double t) => t * log10polynomian(t, a, b, c);
|
||||||
|
@ -135,57 +137,57 @@ class IlfordFilm extends Film {
|
||||||
/// https://www.ilfordphoto.com/amfile/file/download/file/1948/product/1650/
|
/// https://www.ilfordphoto.com/amfile/file/download/file/1948/product/1650/
|
||||||
const IlfordFilm.ortho()
|
const IlfordFilm.ortho()
|
||||||
: reciprocityPower = 1.25,
|
: reciprocityPower = 1.25,
|
||||||
super('Ilford ORTHO+', 80);
|
super('Ilford ORTHO+', 80); // coverage:ignore-line
|
||||||
|
|
||||||
/// https://www.ilfordphoto.com/amfile/file/download/file/1919/product/686/
|
/// https://www.ilfordphoto.com/amfile/file/download/file/1919/product/686/
|
||||||
const IlfordFilm.fp4()
|
const IlfordFilm.fp4()
|
||||||
: reciprocityPower = 1.26,
|
: reciprocityPower = 1.26,
|
||||||
super('Ilford FP4+', 125);
|
super('Ilford FP4+', 125); // coverage:ignore-line
|
||||||
|
|
||||||
/// https://www.ilfordphoto.com/amfile/file/download/file/1903/product/691/
|
/// https://www.ilfordphoto.com/amfile/file/download/file/1903/product/691/
|
||||||
const IlfordFilm.hp5()
|
const IlfordFilm.hp5()
|
||||||
: reciprocityPower = 1.31,
|
: reciprocityPower = 1.31,
|
||||||
super('Ilford HP5+', 400);
|
super('Ilford HP5+', 400); // coverage:ignore-line
|
||||||
|
|
||||||
/// https://www.ilfordphoto.com/amfile/file/download/file/3/product/679/
|
/// https://www.ilfordphoto.com/amfile/file/download/file/3/product/679/
|
||||||
const IlfordFilm.delta100()
|
const IlfordFilm.delta100()
|
||||||
: reciprocityPower = 1.26,
|
: reciprocityPower = 1.26,
|
||||||
super('Ilford DELTA 100', 100);
|
super('Ilford DELTA 100', 100); // coverage:ignore-line
|
||||||
|
|
||||||
/// https://www.ilfordphoto.com/amfile/file/download/file/1915/product/684/
|
/// https://www.ilfordphoto.com/amfile/file/download/file/1915/product/684/
|
||||||
const IlfordFilm.delta400()
|
const IlfordFilm.delta400()
|
||||||
: reciprocityPower = 1.41,
|
: reciprocityPower = 1.41,
|
||||||
super('Ilford DELTA 400', 400);
|
super('Ilford DELTA 400', 400); // coverage:ignore-line
|
||||||
|
|
||||||
/// https://www.ilfordphoto.com/amfile/file/download/file/1913/product/682/
|
/// https://www.ilfordphoto.com/amfile/file/download/file/1913/product/682/
|
||||||
const IlfordFilm.delta3200()
|
const IlfordFilm.delta3200()
|
||||||
: reciprocityPower = 1.33,
|
: reciprocityPower = 1.33,
|
||||||
super('Ilford DELTA 3200', 3200);
|
super('Ilford DELTA 3200', 3200); // coverage:ignore-line
|
||||||
|
|
||||||
/// https://www.ilfordphoto.com/amfile/file/download/file/1905/product/699/
|
/// https://www.ilfordphoto.com/amfile/file/download/file/1905/product/699/
|
||||||
const IlfordFilm.panf()
|
const IlfordFilm.panf()
|
||||||
: reciprocityPower = 1.33,
|
: reciprocityPower = 1.33,
|
||||||
super('Ilford Pan F+', 50);
|
super('Ilford Pan F+', 50); // coverage:ignore-line
|
||||||
|
|
||||||
/// https://www.ilfordphoto.com/amfile/file/download/file/1907/product/701/
|
/// https://www.ilfordphoto.com/amfile/file/download/file/1907/product/701/
|
||||||
const IlfordFilm.sfx200()
|
const IlfordFilm.sfx200()
|
||||||
: reciprocityPower = 1.31,
|
: reciprocityPower = 1.31,
|
||||||
super('Ilford SFX 200', 200);
|
super('Ilford SFX 200', 200); // coverage:ignore-line
|
||||||
|
|
||||||
/// https://www.ilfordphoto.com/amfile/file/download/file/1909/product/703/
|
/// https://www.ilfordphoto.com/amfile/file/download/file/1909/product/703/
|
||||||
const IlfordFilm.xp2super()
|
const IlfordFilm.xp2super()
|
||||||
: reciprocityPower = 1.31,
|
: reciprocityPower = 1.31,
|
||||||
super('Ilford XP2 SUPER', 400);
|
super('Ilford XP2 SUPER', 400); // coverage:ignore-line
|
||||||
|
|
||||||
/// https://www.ilfordphoto.com/amfile/file/download/file/1958/product/696/
|
/// https://www.ilfordphoto.com/amfile/file/download/file/1958/product/696/
|
||||||
const IlfordFilm.pan100()
|
const IlfordFilm.pan100()
|
||||||
: reciprocityPower = 1.26,
|
: reciprocityPower = 1.26,
|
||||||
super('Kentemere 100', 100);
|
super('Kentemere 100', 100); // coverage:ignore-line
|
||||||
|
|
||||||
/// https://www.ilfordphoto.com/amfile/file/download/file/1959/product/697/
|
/// https://www.ilfordphoto.com/amfile/file/download/file/1959/product/697/
|
||||||
const IlfordFilm.pan400()
|
const IlfordFilm.pan400()
|
||||||
: reciprocityPower = 1.30,
|
: reciprocityPower = 1.30,
|
||||||
super('Kentemere 400', 400);
|
super('Kentemere 400', 400); // coverage:ignore-line
|
||||||
|
|
||||||
@override
|
@override
|
||||||
double reciprocityFormula(double t) => pow(t, reciprocityPower).toDouble();
|
double reciprocityFormula(double t) => pow(t, reciprocityPower).toDouble();
|
||||||
|
@ -197,34 +199,34 @@ class KodakFilm extends Film {
|
||||||
final double c;
|
final double c;
|
||||||
|
|
||||||
const KodakFilm.tmax100()
|
const KodakFilm.tmax100()
|
||||||
: a = 1 / 6,
|
: a = 1 / 6, // coverage:ignore-line
|
||||||
b = 0,
|
b = 0, // coverage:ignore-line
|
||||||
c = 4 / 3,
|
c = 4 / 3, // coverage:ignore-line
|
||||||
super('Kodak T-MAX 100', 100);
|
super('Kodak T-MAX 100', 100); // coverage:ignore-line
|
||||||
|
|
||||||
const KodakFilm.tmax400()
|
const KodakFilm.tmax400()
|
||||||
: a = 2 / 3,
|
: a = 2 / 3, // coverage:ignore-line
|
||||||
b = -1 / 2,
|
b = -1 / 2, // coverage:ignore-line
|
||||||
c = 4 / 3,
|
c = 4 / 3, // coverage:ignore-line
|
||||||
super('Kodak T-MAX 400', 400);
|
super('Kodak T-MAX 400', 400); // coverage:ignore-line
|
||||||
|
|
||||||
const KodakFilm.tmax3200()
|
const KodakFilm.tmax3200()
|
||||||
: a = 7 / 6,
|
: a = 7 / 6, // coverage:ignore-line
|
||||||
b = -1,
|
b = -1, // coverage:ignore-line
|
||||||
c = 4 / 3,
|
c = 4 / 3, // coverage:ignore-line
|
||||||
super('Kodak T-MAX 3200', 3200);
|
super('Kodak T-MAX 3200', 3200); // coverage:ignore-line
|
||||||
|
|
||||||
const KodakFilm.trix320()
|
const KodakFilm.trix320()
|
||||||
: a = 2,
|
: a = 2,
|
||||||
b = 1,
|
b = 1,
|
||||||
c = 2,
|
c = 2,
|
||||||
super('Kodak TRI-X 320', 320);
|
super('Kodak TRI-X 320', 320); // coverage:ignore-line
|
||||||
|
|
||||||
const KodakFilm.trix400()
|
const KodakFilm.trix400()
|
||||||
: a = 2,
|
: a = 2,
|
||||||
b = 1,
|
b = 1,
|
||||||
c = 2,
|
c = 2,
|
||||||
super('Kodak TRI-X 400', 400);
|
super('Kodak TRI-X 400', 400); // coverage:ignore-line
|
||||||
|
|
||||||
@override
|
@override
|
||||||
double reciprocityFormula(double t) => t * log10polynomian(t, a, b, c);
|
double reciprocityFormula(double t) => t * log10polynomian(t, a, b, c);
|
||||||
|
|
121
test/data/models/film_test.dart
Normal file
121
test/data/models/film_test.dart
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
import 'package:lightmeter/data/models/film.dart';
|
||||||
|
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||||
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
test('iso', () {
|
||||||
|
expect(const Film.other().iso, 0);
|
||||||
|
expect(const FomapanFilm.creative100().iso, 100);
|
||||||
|
expect(const FomapanFilm.creative200().iso, 200);
|
||||||
|
expect(const FomapanFilm.action400().iso, 400);
|
||||||
|
expect(const IlfordFilm.ortho().iso, 80);
|
||||||
|
expect(const IlfordFilm.delta100().iso, 100);
|
||||||
|
expect(const IlfordFilm.delta400().iso, 400);
|
||||||
|
expect(const IlfordFilm.delta3200().iso, 3200);
|
||||||
|
expect(const IlfordFilm.fp4().iso, 125);
|
||||||
|
expect(const IlfordFilm.hp5().iso, 400);
|
||||||
|
expect(const IlfordFilm.panf().iso, 50);
|
||||||
|
expect(const IlfordFilm.sfx200().iso, 200);
|
||||||
|
expect(const IlfordFilm.xp2super().iso, 400);
|
||||||
|
expect(const IlfordFilm.pan100().iso, 100);
|
||||||
|
expect(const IlfordFilm.pan400().iso, 400);
|
||||||
|
expect(const KodakFilm.tmax100().iso, 100);
|
||||||
|
expect(const KodakFilm.tmax400().iso, 400);
|
||||||
|
expect(const KodakFilm.tmax3200().iso, 3200);
|
||||||
|
expect(const KodakFilm.trix320().iso, 320);
|
||||||
|
expect(const KodakFilm.trix400().iso, 400);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('toString()', () {
|
||||||
|
expect(const Film.other().toString(), "");
|
||||||
|
expect(const FomapanFilm.creative100().toString(), "Fomapan CREATIVE 100");
|
||||||
|
expect(const FomapanFilm.creative200().toString(), "Fomapan CREATIVE 200");
|
||||||
|
expect(const FomapanFilm.action400().toString(), "Fomapan ACTION 400");
|
||||||
|
expect(const IlfordFilm.ortho().toString(), "Ilford ORTHO+");
|
||||||
|
expect(const IlfordFilm.delta100().toString(), "Ilford DELTA 100");
|
||||||
|
expect(const IlfordFilm.delta400().toString(), "Ilford DELTA 400");
|
||||||
|
expect(const IlfordFilm.delta3200().toString(), "Ilford DELTA 3200");
|
||||||
|
expect(const IlfordFilm.fp4().toString(), "Ilford FP4+");
|
||||||
|
expect(const IlfordFilm.hp5().toString(), "Ilford HP5+");
|
||||||
|
expect(const IlfordFilm.panf().toString(), "Ilford Pan F+");
|
||||||
|
expect(const IlfordFilm.sfx200().toString(), "Ilford SFX 200");
|
||||||
|
expect(const IlfordFilm.xp2super().toString(), "Ilford XP2 SUPER");
|
||||||
|
expect(const IlfordFilm.pan100().toString(), "Kentemere 100");
|
||||||
|
expect(const IlfordFilm.pan400().toString(), "Kentemere 400");
|
||||||
|
expect(const KodakFilm.tmax100().toString(), "Kodak T-MAX 100");
|
||||||
|
expect(const KodakFilm.tmax400().toString(), "Kodak T-MAX 400");
|
||||||
|
expect(const KodakFilm.tmax3200().toString(), "Kodak T-MAX 3200");
|
||||||
|
expect(const KodakFilm.trix320().toString(), "Kodak TRI-X 320");
|
||||||
|
expect(const KodakFilm.trix400().toString(), "Kodak TRI-X 400");
|
||||||
|
});
|
||||||
|
|
||||||
|
group(
|
||||||
|
'reciprocityFailure',
|
||||||
|
() {
|
||||||
|
const inputSpeeds = [
|
||||||
|
ShutterSpeedValue(1000, true, StopType.full),
|
||||||
|
ShutterSpeedValue(1, false, StopType.full),
|
||||||
|
ShutterSpeedValue(16, false, StopType.full)
|
||||||
|
];
|
||||||
|
test('No change `Film.other()`', () {
|
||||||
|
expect(
|
||||||
|
const Film.other().reciprocityFailure(inputSpeeds[0]),
|
||||||
|
const ShutterSpeedValue(1000, true, StopType.full),
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
const Film.other().reciprocityFailure(inputSpeeds[1]),
|
||||||
|
const ShutterSpeedValue(1, false, StopType.full),
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
const Film.other().reciprocityFailure(inputSpeeds[2]),
|
||||||
|
const ShutterSpeedValue(16, false, StopType.full),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('pow `IlfordFilm.delta100()`', () {
|
||||||
|
expect(
|
||||||
|
const IlfordFilm.delta100().reciprocityFailure(inputSpeeds[0]),
|
||||||
|
const ShutterSpeedValue(1000, true, StopType.full),
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
const IlfordFilm.delta100().reciprocityFailure(inputSpeeds[1]),
|
||||||
|
const ShutterSpeedValue(1, false, StopType.full),
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
const IlfordFilm.delta100().reciprocityFailure(inputSpeeds[2]),
|
||||||
|
const ShutterSpeedValue(32.899642452994128, false, StopType.full),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('log10polynomian `FomapanFilm.creative100()`', () {
|
||||||
|
expect(
|
||||||
|
const FomapanFilm.creative100().reciprocityFailure(inputSpeeds[0]),
|
||||||
|
const ShutterSpeedValue(1000, true, StopType.full),
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
const FomapanFilm.creative100().reciprocityFailure(inputSpeeds[1]),
|
||||||
|
const ShutterSpeedValue(2, false, StopType.full),
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
const FomapanFilm.creative100().reciprocityFailure(inputSpeeds[2]),
|
||||||
|
const ShutterSpeedValue(151.52807753457483, false, StopType.full),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('log10polynomian `Kodak.tmax400()`', () {
|
||||||
|
expect(
|
||||||
|
const KodakFilm.tmax400().reciprocityFailure(inputSpeeds[0]),
|
||||||
|
const ShutterSpeedValue(1000, true, StopType.full),
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
const KodakFilm.tmax400().reciprocityFailure(inputSpeeds[1]),
|
||||||
|
const ShutterSpeedValue(1.3333333333333333, false, StopType.full),
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
const KodakFilm.tmax400().reciprocityFailure(inputSpeeds[2]),
|
||||||
|
const ShutterSpeedValue(27.166026086819844, false, StopType.full),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
Loading…
Reference in a new issue